diff options
author | Max Goltzsche <max.goltzsche@gmail.com> | 2024-03-17 19:02:16 +0100 |
---|---|---|
committer | Max Goltzsche <max.goltzsche@gmail.com> | 2024-04-13 04:55:43 +0200 |
commit | 883bbb3e4bf08a3afaed357e74b1997019bfd683 (patch) | |
tree | eb686f942d25209d1743e0a75189577762493f1f | |
parent | c0afd3eb3c897b3651c52c04b37ce597dfe9d2ce (diff) |
smartplaylist: rename output format m3u8 to extm3u
-rw-r--r-- | beetsplug/smartplaylist.py | 12 | ||||
-rw-r--r-- | docs/plugins/smartplaylist.rst | 4 | ||||
-rw-r--r-- | test/plugins/test_smartplaylist.py | 8 |
3 files changed, 12 insertions, 12 deletions
diff --git a/beetsplug/smartplaylist.py b/beetsplug/smartplaylist.py index 7e16d3390..9df2cca64 100644 --- a/beetsplug/smartplaylist.py +++ b/beetsplug/smartplaylist.py @@ -121,7 +121,7 @@ class SmartPlaylistPlugin(BeetsPlugin): spl_update.parser.add_option( "--output", type="string", - help="specify the playlist format: m3u|m3u8.", + help="specify the playlist format: m3u|extm3u.", ) spl_update.func = self.update_cmd return [spl_update] @@ -313,20 +313,20 @@ class SmartPlaylistPlugin(BeetsPlugin): ) mkdirall(m3u_path) pl_format = self.config["output"].get() - if pl_format != "m3u" and pl_format != "m3u8": + if pl_format != "m3u" and pl_format != "extm3u": msg = "Unsupported output format '{}' provided! " - msg += "Supported: m3u, m3u8" + msg += "Supported: m3u, extm3u" raise Exception(msg.format(pl_format)) - m3u8 = pl_format == "m3u8" + extm3u = pl_format == "extm3u" with open(syspath(m3u_path), "wb") as f: keys = [] - if m3u8: + if extm3u: keys = self.config["fields"].get(list) f.write(b"#EXTM3U\n") for entry in m3us[m3u]: item = entry.item comment = "" - if m3u8: + if extm3u: attr = [(k, entry.item[k]) for k in keys] al = [ f" {a[0]}={json.dumps(str(a[1]))}" for a in attr diff --git a/docs/plugins/smartplaylist.rst b/docs/plugins/smartplaylist.rst index 057f9910d..f07d9b1d7 100644 --- a/docs/plugins/smartplaylist.rst +++ b/docs/plugins/smartplaylist.rst @@ -122,11 +122,11 @@ other configuration options are: playlist item URI, e.g. ``http://beets:8337/item/$id/file``. When this option is specified, the local path-related options ``prefix``, ``relative_to``, ``forward_slash`` and ``urlencode`` are ignored. -- **output**: Specify the playlist format: m3u|m3u8. Default ``m3u``. +- **output**: Specify the playlist format: m3u|extm3u. Default ``m3u``. - **fields**: Specify the names of the additional item fields to export into the playlist. This allows using e.g. the ``id`` field within other tools such as the `webm3u`_ plugin. - To use this option, you must set the ``output`` option to ``m3u8``. + To use this option, you must set the ``output`` option to ``extm3u``. .. _webm3u: https://github.com/mgoltzsche/beets-webm3u diff --git a/test/plugins/test_smartplaylist.py b/test/plugins/test_smartplaylist.py index 15841640b..470350f03 100644 --- a/test/plugins/test_smartplaylist.py +++ b/test/plugins/test_smartplaylist.py @@ -191,7 +191,7 @@ class SmartPlaylistTest(_common.TestCase): self.assertEqual(content, b"/tagada.mp3\n") - def test_playlist_update_output_m3u8(self): + def test_playlist_update_output_extm3u(self): spl = SmartPlaylistPlugin() i = MagicMock() @@ -215,7 +215,7 @@ class SmartPlaylistTest(_common.TestCase): spl._matched_playlists = [pl] dir = bytestring_path(mkdtemp()) - config["smartplaylist"]["output"] = "m3u8" + config["smartplaylist"]["output"] = "extm3u" config["smartplaylist"]["prefix"] = "http://beets:8337/files" config["smartplaylist"]["relative_to"] = False config["smartplaylist"]["playlist_dir"] = py3_path(dir) @@ -241,7 +241,7 @@ class SmartPlaylistTest(_common.TestCase): + b"http://beets:8337/files/tagada.mp3\n", ) - def test_playlist_update_output_m3u8_fields(self): + def test_playlist_update_output_extm3u_fields(self): spl = SmartPlaylistPlugin() i = MagicMock() @@ -267,7 +267,7 @@ class SmartPlaylistTest(_common.TestCase): spl._matched_playlists = [pl] dir = bytestring_path(mkdtemp()) - config["smartplaylist"]["output"] = "m3u8" + config["smartplaylist"]["output"] = "extm3u" config["smartplaylist"]["relative_to"] = False config["smartplaylist"]["playlist_dir"] = py3_path(dir) config["smartplaylist"]["fields"] = ["id", "genre"] |