File: startup_workdir.py

package info (click to toggle)
streamtuner2 2.2.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,432 kB
  • sloc: python: 8,976; makefile: 91; php: 51; sh: 7; perl: 3
file content (35 lines) | stat: -rw-r--r-- 932 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# encoding: utf-8
# title: Working directory
# description: Changes to another directory on startup
# version: 0.1
# priority: rare
# depends: streamtuner2 >= 2.1.5
# type: feature
# category: session
# config:
#   { name: start_dir, value: /home/$USER/Music, type: string, decription: Switch to this directory. }
#
# Can be used to predefine an alternative start directory,
# which also influences where streamrippers downloads to.
#
# This is somewhat redundant, as you can specify the working
# directory in your Desktop starter already; or set the path
# for streamripper with a parameter.

from config import conf
import os, os.path

# Stop button
class startup_workdir(object):
    module = 'startup_workdir'

    # button + hook
    def __init__(self, parent):
        os.chdir(
            os.path.expandvars(
                os.path.expanduser(
                    conf.start_dir
                )
            )
        )