diff options
-rw-r--r-- | README.md | 13 | ||||
-rwxr-xr-x | mpris_to_text.py (renamed from music_update.py) | 19 |
2 files changed, 20 insertions, 12 deletions
@@ -6,5 +6,14 @@ A Python script that fetches media data from MPRIS-compliant media players and s | |||
6 | 6 | ||
7 | ## Required packages | 7 | ## Required packages |
8 | 8 | ||
9 | - [blessed](https://github.com/jquast/blessed) | 9 | - [blessed](https://github.com/jquast/blessed): Terminal UI |
10 | - [dbussy](https://github.com/ldo/dbussy) | 10 | - [dbussy](https://github.com/ldo/dbussy): DBus client |
11 | |||
12 | ## Parameters | ||
13 | |||
14 | - `-h`: Display help | ||
15 | - `--file`: Full path to the file the data is written into | ||
16 | - `--format-artist`: Format string for the artist part | ||
17 | - `--format-title`: Format string for the title part | ||
18 | - `--format-album`: Format string for the album part | ||
19 | - `--format`: Format string that puts all parts together | ||
diff --git a/music_update.py b/mpris_to_text.py index d9f14c3..1284300 100755 --- a/music_update.py +++ b/mpris_to_text.py | |||
@@ -9,15 +9,14 @@ import signal | |||
9 | 9 | ||
10 | from blessed import Terminal | 10 | from blessed import Terminal |
11 | 11 | ||
12 | import dbussy as dbus | ||
13 | import ravel | 12 | import ravel |
14 | 13 | ||
15 | 14 | ||
16 | loop = asyncio.get_event_loop() | 15 | loop = asyncio.get_event_loop() |
17 | name_regex = re.compile("^org\.mpris\.MediaPlayer2\.") | 16 | name_regex = re.compile("^org\.mpris\.MediaPlayer2\.") |
18 | |||
19 | bus = None | 17 | bus = None |
20 | term = Terminal() | 18 | term = Terminal() |
19 | |||
21 | refresh_cond = threading.Condition() | 20 | refresh_cond = threading.Condition() |
22 | refresh_flag = True | 21 | refresh_flag = True |
23 | exit_flag = False | 22 | exit_flag = False |
@@ -253,12 +252,6 @@ def read_args(): | |||
253 | default = "/tmp/mpris_info.txt", | 252 | default = "/tmp/mpris_info.txt", |
254 | help = "Full path to file (default: \"/tmp/mpris_info.txt\")" | 253 | help = "Full path to file (default: \"/tmp/mpris_info.txt\")" |
255 | ) | 254 | ) |
256 | parser.add_argument("--format-order", | ||
257 | type = str, | ||
258 | dest = "format", | ||
259 | default = "{artist}{title}{album} ", | ||
260 | help = "Format string (default: \"{artist}{title}{album} \")" | ||
261 | ) | ||
262 | parser.add_argument("--format-artist", | 255 | parser.add_argument("--format-artist", |
263 | type = str, | 256 | type = str, |
264 | dest = "format_artist", | 257 | dest = "format_artist", |
@@ -277,6 +270,12 @@ def read_args(): | |||
277 | default = " from \"{}\"", | 270 | default = " from \"{}\"", |
278 | help = "Format string for the album part (default: \" from \"{}\"\")" | 271 | help = "Format string for the album part (default: \" from \"{}\"\")" |
279 | ) | 272 | ) |
273 | parser.add_argument("--format", | ||
274 | type = str, | ||
275 | dest = "format", | ||
276 | default = "{artist}{title}{album} ", | ||
277 | help = "Full format string (default: \"{artist}{title}{album} \")" | ||
278 | ) | ||
280 | 279 | ||
281 | args = parser.parse_args() | 280 | args = parser.parse_args() |
282 | filename = args.filename | 281 | filename = args.filename |