plexutil 2.0.0__tar.gz → 2.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. plexutil-2.0.2/PKG-INFO +242 -0
  2. plexutil-2.0.2/README.md +198 -0
  3. {plexutil-2.0.0 → plexutil-2.0.2}/pyproject.toml +1 -1
  4. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/core/playlist.py +1 -0
  5. plexutil-2.0.2/src/plexutil.egg-info/PKG-INFO +242 -0
  6. plexutil-2.0.0/PKG-INFO +0 -116
  7. plexutil-2.0.0/README.md +0 -72
  8. plexutil-2.0.0/src/plexutil.egg-info/PKG-INFO +0 -116
  9. {plexutil-2.0.0 → plexutil-2.0.2}/.github/workflows/python-publish.yml +0 -0
  10. {plexutil-2.0.0 → plexutil-2.0.2}/.gitignore +0 -0
  11. {plexutil-2.0.0 → plexutil-2.0.2}/LICENSE +0 -0
  12. {plexutil-2.0.0 → plexutil-2.0.2}/MANIFEST.in +0 -0
  13. {plexutil-2.0.0 → plexutil-2.0.2}/git-hooks/commit-msg +0 -0
  14. {plexutil-2.0.0 → plexutil-2.0.2}/git-hooks/pre-commit +0 -0
  15. {plexutil-2.0.0 → plexutil-2.0.2}/init.sh +0 -0
  16. {plexutil-2.0.0 → plexutil-2.0.2}/requirements.txt +0 -0
  17. {plexutil-2.0.0 → plexutil-2.0.2}/ruff.toml +0 -0
  18. {plexutil-2.0.0 → plexutil-2.0.2}/setup.cfg +0 -0
  19. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/__init__.py +0 -0
  20. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/__main__.py +0 -0
  21. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/config/log_config.yaml +0 -0
  22. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/core/__init__.py +0 -0
  23. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/core/library.py +0 -0
  24. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/core/movie_library.py +0 -0
  25. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/core/music_library.py +0 -0
  26. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/core/prompt.py +0 -0
  27. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/core/server_config.py +0 -0
  28. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/core/tv_library.py +0 -0
  29. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/__init__.py +0 -0
  30. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/bootstrap_paths_dto.py +0 -0
  31. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/library_preferences_dto.py +0 -0
  32. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/local_file_dto.py +0 -0
  33. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/movie_dto.py +0 -0
  34. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/music_playlist_dto.py +0 -0
  35. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/server_config_dto.py +0 -0
  36. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/song_dto.py +0 -0
  37. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/tv_episode_dto.py +0 -0
  38. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/tv_language_manifest_dto.py +0 -0
  39. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/tv_series_dto.py +0 -0
  40. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/dto/user_instructions_dto.py +0 -0
  41. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/enums/__init__.py +0 -0
  42. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/enums/agent.py +0 -0
  43. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/enums/file_type.py +0 -0
  44. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/enums/language.py +0 -0
  45. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/enums/library_name.py +0 -0
  46. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/enums/library_type.py +0 -0
  47. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/enums/scanner.py +0 -0
  48. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/enums/user_request.py +0 -0
  49. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/__init__.py +0 -0
  50. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/bootstrap_error.py +0 -0
  51. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/database_connection_error.py +0 -0
  52. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/entity_not_found_error.py +0 -0
  53. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/library_illegal_state_error.py +0 -0
  54. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/library_op_error.py +0 -0
  55. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/library_poll_timeout_error.py +0 -0
  56. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/library_section_missing_error.py +0 -0
  57. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/library_unsupported_error.py +0 -0
  58. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/server_config_error.py +0 -0
  59. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/unexpected_argument_error.py +0 -0
  60. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/unexpected_naming_pattern_error.py +0 -0
  61. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/exception/user_error.py +0 -0
  62. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/mapper/__init__.py +0 -0
  63. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/mapper/music_playlist_mapper.py +0 -0
  64. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/mapper/server_config_mapper.py +0 -0
  65. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/mapper/song_mapper.py +0 -0
  66. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/model/__init__.py +0 -0
  67. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/model/music_playlist_entity.py +0 -0
  68. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/model/plexutil_library_config.py +0 -0
  69. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/model/server_config_entity.py +0 -0
  70. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/model/song_entity.py +0 -0
  71. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/model/song_music_playlist_entity.py +0 -0
  72. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/plex_util_logger.py +0 -0
  73. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/sample/manifests/tv_language_manifest.json +0 -0
  74. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/sample/preferences/movie_library_preferences.json +0 -0
  75. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/sample/preferences/music_library_preferences.json +0 -0
  76. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/sample/preferences/plex_server_setting_preferences.json +0 -0
  77. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/sample/preferences/tv_library_preferences.json +0 -0
  78. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/schemas/v1/preferences_schema.json +0 -0
  79. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/schemas/v1/tv_language_manifest_schema.json +0 -0
  80. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/service/__init__.py +0 -0
  81. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/service/db_manager.py +0 -0
  82. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/service/music_playlist_service.py +0 -0
  83. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/service/server_config_service.py +0 -0
  84. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/service/song_music_playlist_composite_service.py +0 -0
  85. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/service/song_service.py +0 -0
  86. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/static.py +0 -0
  87. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/util/__init__.py +0 -0
  88. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/util/file_importer.py +0 -0
  89. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/util/path_ops.py +0 -0
  90. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/util/plex_ops.py +0 -0
  91. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/util/query_builder.py +0 -0
  92. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil/util/token_manager.py +0 -0
  93. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil.egg-info/SOURCES.txt +0 -0
  94. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil.egg-info/dependency_links.txt +0 -0
  95. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil.egg-info/entry_points.txt +0 -0
  96. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil.egg-info/requires.txt +0 -0
  97. {plexutil-2.0.0 → plexutil-2.0.2}/src/plexutil.egg-info/top_level.txt +0 -0
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.2
2
+ Name: plexutil
3
+ Version: 2.0.2
4
+ Author-email: Carlos Florez <carlos@florez.co.uk>
5
+ Maintainer-email: Carlos Florez <carlos@florez.co.uk>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 CARLOS FLOREZ
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Repository, https://github.com/florez-carlos/plexutil
29
+ Classifier: Development Status :: 5 - Production/Stable
30
+ Classifier: Programming Language :: Python :: 3.11
31
+ Requires-Python: >=3.11.6
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: PlexAPI==4.15.7
35
+ Requires-Dist: alive-progress==3.1.5
36
+ Requires-Dist: pyyaml==6.0.1
37
+ Requires-Dist: toml==0.10.2
38
+ Requires-Dist: pywin32==306; sys_platform == "win32"
39
+ Requires-Dist: jsonschema==4.23.0
40
+ Requires-Dist: peewee==3.17.7
41
+ Requires-Dist: colorlog==6.4.0
42
+ Requires-Dist: keyring==25.5.0
43
+ Requires-Dist: cryptography==44.0.0
44
+
45
+ # Plexutil
46
+
47
+ CLI tool with helpful functions to manage a Plex server.
48
+
49
+
50
+ > [!NOTE]
51
+ > Installation is supported only for the following:
52
+ > - Windows
53
+ > - Linux
54
+
55
+ > [!NOTE]
56
+ > Development requires a fully configured [Dotfiles](https://github.com/florez-carlos/dotfiles) dev environment <br>
57
+
58
+ ## Table of Contents
59
+
60
+ * [Installation](#installation)
61
+ * [Configuration](#configuration)
62
+ * [Required](#required)
63
+ * [Optional](#optional)
64
+ * [TV Series Language Override](#tv-series-language-override)
65
+ * [Library Preferences](#library-preferences)
66
+ * [Server Setting Preferences](#server-setting-preferences)
67
+ * [Usage](#usage)
68
+ * [Creating a media library](#creating-a-media-library)
69
+ * [Deleting a media library](#deleting-a-media-library)
70
+ * [Creating a Playlist](#creating-a-playlist)
71
+ * [Deleting a Playlist](#deleting-a-playlist)
72
+ * [Adding songs to a Playlist](#adding-songs-to-a-playlist)
73
+ * [Exporting/Importing Music Playlists](#exportingimporting-music-playlists)
74
+ * [Development](#development)
75
+ * [Config Location](#config-location)
76
+ * [Log Location](#log-location)
77
+
78
+
79
+ ## Installation
80
+
81
+ ```bash
82
+ pip install plexutil
83
+ ```
84
+
85
+ ## Configuration
86
+ ### Required
87
+ Set the host, port, token of your plex server
88
+ ```bash
89
+ plexutil config -host <PLEX_SERVER_HOST> -port <PLEX_SERVER_PORT> -token <PLEX_SERVER_TOKEN>
90
+ ```
91
+ ### Optional
92
+ #### TV Series Language Override
93
+ To override the language of tv series, modify the tv_language_manifest.json file found in: [Config Location](#config-location) <br >
94
+ The file can be modified like such:
95
+ ```bash
96
+ {
97
+ "es-ES": [327417,396583,388477,292262,282670,274522],
98
+ "en-US": []
99
+ }
100
+ ```
101
+ Where the key is the language and the list contains the [TVDB](https://www.thetvdb.com/) ids of the desired series to be overriden <br >
102
+ For a list of supported languages: [Language](./src/plexutil/enums/language.py)
103
+
104
+ ---
105
+
106
+ #### Library Preferences
107
+ Libraries of type:
108
+ - Movie
109
+ - Music
110
+ - TV
111
+
112
+ Can have their preferences set in the following files:
113
+
114
+ - movie_library_preferences.json
115
+ - music_library_preferences.json
116
+ - tv_library_preferences.json
117
+
118
+ These files can be found here: [Config Location](#config-location) <br >
119
+ These Preferences are set at library creation time <br >
120
+ The files already include default preferences that can be removed/modified/added based on your needs <br >
121
+
122
+ ---
123
+
124
+ #### Server Setting Preferences
125
+ These preferences modify the behavior of the server
126
+
127
+ - plex_server_setting_preferences.json
128
+
129
+ The file can be found here: [Config Location](#config-location) <br >
130
+ For example:
131
+ ```json
132
+ "ButlerStartHour": 23,
133
+ ```
134
+ Starts scheduled tasks at 11:00PM local time, to modify this time to 1:00AM
135
+ ```json
136
+ "ButlerStartHour": 1,
137
+ ```
138
+ These modifications need to be set by doing:
139
+ ```bash
140
+ plexutil set_server_settings
141
+ ```
142
+ The file already includes default preferences that can be removed/modified/added based on your needs <br >
143
+
144
+ ---
145
+
146
+ ## Usage
147
+ ### Creating a media library:
148
+ > [!NOTE]
149
+ > If language is not supplied, the default is en-US
150
+ ```bash
151
+ plexutil create_movie_library -libn <NAME_OF_THE_LIBRARY> -loc </PATH/TO/MEDIA/LOCATION> -l <LANGUAGE>
152
+ ```
153
+ ---
154
+
155
+ ### Deleting a media library:
156
+ ```bash
157
+ plexutil delete_movie_library -libn <NAME_OF_THE_LIBRARY>
158
+ ```
159
+ ---
160
+
161
+ ### Creating a Playlist
162
+ > [!NOTE]
163
+ > Only Music Playlists are currently supported
164
+ ```bash
165
+ plexutil create_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLIST_IS> -pn <NAME_OF_THE_PLAYLIST> -s /path/to/song.mp3 /path/to/another-song.mp3
166
+ ```
167
+ > [!NOTE]
168
+ > The paths passed to -s must match the location of the library <br >
169
+ > Therefore, if the library has for location /media/music these song paths must be in /media/music/song.mp3
170
+
171
+ ---
172
+
173
+ ### Deleting a Playlist
174
+ > [!NOTE]
175
+ > Only Music Playlists are currently supported
176
+ ```bash
177
+ plexutil delete_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLIST_IS> -pn <NAME_OF_THE_PLAYLIST>
178
+ ```
179
+
180
+ ---
181
+
182
+ ### Adding songs to a Playlist
183
+
184
+ ```bash
185
+ plexutil add_songs_to_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLIST_IS> -pn <NAME_OF_THE_PLAYLIST> -s /path/to/song.mp3 /path/to/another-song.mp3
186
+ ```
187
+ > [!NOTE]
188
+ > The paths passed to -s must match the location of the library <br >
189
+ > Therefore, if the library has for location /media/music these song paths must be in /media/music/song.mp3
190
+
191
+ ---
192
+
193
+ ### Exporting/Importing Music Playlists
194
+ Music Playlists can be exported to a playlists.db file, this file can later be imported to another Plex server with plexutil
195
+ ```bash
196
+ plexutil export_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLISTS_ARE>
197
+ ```
198
+ This action will create a playlists.db file here: [Config Location](#config-location) <br >
199
+ This file can then be used to recreate the playlists in another Plex Server with plexutil by doing
200
+ ```bash
201
+ plexutil import_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLISTS_ARE>
202
+ ```
203
+ > [!NOTE]
204
+ > The songs in the Music Library of the importing server must match the songs in the exporting server
205
+
206
+ ---
207
+
208
+ ## Development
209
+ ```bash
210
+ source init.sh
211
+ ```
212
+ ## Config Location
213
+ The config directory of Plexutil is located:
214
+ > [!NOTE]
215
+ > Replace <YOUR_USER> with your Windows UserName
216
+ - Windows
217
+ ```bash
218
+ C:\Users\<YOUR_USER>\Documents\plexutil\config\
219
+ ```
220
+ - Linux
221
+ ```bash
222
+ $HOME/plexutil/config/tv_language_manifest.json
223
+ ```
224
+
225
+ ## Log Location
226
+ The log directory of Plexutil is located:
227
+ > [!NOTE]
228
+ > Replace <YOUR_USER> with your Windows UserName
229
+ - Windows
230
+ ```bash
231
+ C:\Users\<YOUR_USER>\Documents\plexutil\log
232
+ ```
233
+ - Linux
234
+ ```bash
235
+ $HOME/plexutil/log
236
+ ```
237
+ > [!NOTE]
238
+ > Log files are archived based on date, such as yyyy-mm-dd.log
239
+
240
+ ## License
241
+ [MIT](https://choosealicense.com/licenses/mit/)
242
+
@@ -0,0 +1,198 @@
1
+ # Plexutil
2
+
3
+ CLI tool with helpful functions to manage a Plex server.
4
+
5
+
6
+ > [!NOTE]
7
+ > Installation is supported only for the following:
8
+ > - Windows
9
+ > - Linux
10
+
11
+ > [!NOTE]
12
+ > Development requires a fully configured [Dotfiles](https://github.com/florez-carlos/dotfiles) dev environment <br>
13
+
14
+ ## Table of Contents
15
+
16
+ * [Installation](#installation)
17
+ * [Configuration](#configuration)
18
+ * [Required](#required)
19
+ * [Optional](#optional)
20
+ * [TV Series Language Override](#tv-series-language-override)
21
+ * [Library Preferences](#library-preferences)
22
+ * [Server Setting Preferences](#server-setting-preferences)
23
+ * [Usage](#usage)
24
+ * [Creating a media library](#creating-a-media-library)
25
+ * [Deleting a media library](#deleting-a-media-library)
26
+ * [Creating a Playlist](#creating-a-playlist)
27
+ * [Deleting a Playlist](#deleting-a-playlist)
28
+ * [Adding songs to a Playlist](#adding-songs-to-a-playlist)
29
+ * [Exporting/Importing Music Playlists](#exportingimporting-music-playlists)
30
+ * [Development](#development)
31
+ * [Config Location](#config-location)
32
+ * [Log Location](#log-location)
33
+
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install plexutil
39
+ ```
40
+
41
+ ## Configuration
42
+ ### Required
43
+ Set the host, port, token of your plex server
44
+ ```bash
45
+ plexutil config -host <PLEX_SERVER_HOST> -port <PLEX_SERVER_PORT> -token <PLEX_SERVER_TOKEN>
46
+ ```
47
+ ### Optional
48
+ #### TV Series Language Override
49
+ To override the language of tv series, modify the tv_language_manifest.json file found in: [Config Location](#config-location) <br >
50
+ The file can be modified like such:
51
+ ```bash
52
+ {
53
+ "es-ES": [327417,396583,388477,292262,282670,274522],
54
+ "en-US": []
55
+ }
56
+ ```
57
+ Where the key is the language and the list contains the [TVDB](https://www.thetvdb.com/) ids of the desired series to be overriden <br >
58
+ For a list of supported languages: [Language](./src/plexutil/enums/language.py)
59
+
60
+ ---
61
+
62
+ #### Library Preferences
63
+ Libraries of type:
64
+ - Movie
65
+ - Music
66
+ - TV
67
+
68
+ Can have their preferences set in the following files:
69
+
70
+ - movie_library_preferences.json
71
+ - music_library_preferences.json
72
+ - tv_library_preferences.json
73
+
74
+ These files can be found here: [Config Location](#config-location) <br >
75
+ These Preferences are set at library creation time <br >
76
+ The files already include default preferences that can be removed/modified/added based on your needs <br >
77
+
78
+ ---
79
+
80
+ #### Server Setting Preferences
81
+ These preferences modify the behavior of the server
82
+
83
+ - plex_server_setting_preferences.json
84
+
85
+ The file can be found here: [Config Location](#config-location) <br >
86
+ For example:
87
+ ```json
88
+ "ButlerStartHour": 23,
89
+ ```
90
+ Starts scheduled tasks at 11:00PM local time, to modify this time to 1:00AM
91
+ ```json
92
+ "ButlerStartHour": 1,
93
+ ```
94
+ These modifications need to be set by doing:
95
+ ```bash
96
+ plexutil set_server_settings
97
+ ```
98
+ The file already includes default preferences that can be removed/modified/added based on your needs <br >
99
+
100
+ ---
101
+
102
+ ## Usage
103
+ ### Creating a media library:
104
+ > [!NOTE]
105
+ > If language is not supplied, the default is en-US
106
+ ```bash
107
+ plexutil create_movie_library -libn <NAME_OF_THE_LIBRARY> -loc </PATH/TO/MEDIA/LOCATION> -l <LANGUAGE>
108
+ ```
109
+ ---
110
+
111
+ ### Deleting a media library:
112
+ ```bash
113
+ plexutil delete_movie_library -libn <NAME_OF_THE_LIBRARY>
114
+ ```
115
+ ---
116
+
117
+ ### Creating a Playlist
118
+ > [!NOTE]
119
+ > Only Music Playlists are currently supported
120
+ ```bash
121
+ plexutil create_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLIST_IS> -pn <NAME_OF_THE_PLAYLIST> -s /path/to/song.mp3 /path/to/another-song.mp3
122
+ ```
123
+ > [!NOTE]
124
+ > The paths passed to -s must match the location of the library <br >
125
+ > Therefore, if the library has for location /media/music these song paths must be in /media/music/song.mp3
126
+
127
+ ---
128
+
129
+ ### Deleting a Playlist
130
+ > [!NOTE]
131
+ > Only Music Playlists are currently supported
132
+ ```bash
133
+ plexutil delete_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLIST_IS> -pn <NAME_OF_THE_PLAYLIST>
134
+ ```
135
+
136
+ ---
137
+
138
+ ### Adding songs to a Playlist
139
+
140
+ ```bash
141
+ plexutil add_songs_to_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLIST_IS> -pn <NAME_OF_THE_PLAYLIST> -s /path/to/song.mp3 /path/to/another-song.mp3
142
+ ```
143
+ > [!NOTE]
144
+ > The paths passed to -s must match the location of the library <br >
145
+ > Therefore, if the library has for location /media/music these song paths must be in /media/music/song.mp3
146
+
147
+ ---
148
+
149
+ ### Exporting/Importing Music Playlists
150
+ Music Playlists can be exported to a playlists.db file, this file can later be imported to another Plex server with plexutil
151
+ ```bash
152
+ plexutil export_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLISTS_ARE>
153
+ ```
154
+ This action will create a playlists.db file here: [Config Location](#config-location) <br >
155
+ This file can then be used to recreate the playlists in another Plex Server with plexutil by doing
156
+ ```bash
157
+ plexutil import_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLISTS_ARE>
158
+ ```
159
+ > [!NOTE]
160
+ > The songs in the Music Library of the importing server must match the songs in the exporting server
161
+
162
+ ---
163
+
164
+ ## Development
165
+ ```bash
166
+ source init.sh
167
+ ```
168
+ ## Config Location
169
+ The config directory of Plexutil is located:
170
+ > [!NOTE]
171
+ > Replace <YOUR_USER> with your Windows UserName
172
+ - Windows
173
+ ```bash
174
+ C:\Users\<YOUR_USER>\Documents\plexutil\config\
175
+ ```
176
+ - Linux
177
+ ```bash
178
+ $HOME/plexutil/config/tv_language_manifest.json
179
+ ```
180
+
181
+ ## Log Location
182
+ The log directory of Plexutil is located:
183
+ > [!NOTE]
184
+ > Replace <YOUR_USER> with your Windows UserName
185
+ - Windows
186
+ ```bash
187
+ C:\Users\<YOUR_USER>\Documents\plexutil\log
188
+ ```
189
+ - Linux
190
+ ```bash
191
+ $HOME/plexutil/log
192
+ ```
193
+ > [!NOTE]
194
+ > Log files are archived based on date, such as yyyy-mm-dd.log
195
+
196
+ ## License
197
+ [MIT](https://choosealicense.com/licenses/mit/)
198
+
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "plexutil"
7
- version = "2.0.0"
7
+ version = "2.0.2"
8
8
  requires-python = ">=3.11.6"
9
9
  authors = [
10
10
  {name = "Carlos Florez", email = "carlos@florez.co.uk"}
@@ -178,6 +178,7 @@ class Playlist(Library):
178
178
  Returns:
179
179
  None: This method does not return a value
180
180
  """
181
+ self.probe_library()
181
182
  filtered_tracks = self.__get_filtered_tracks()
182
183
  playlist = self.get_section().playlist(self.playlist_name)
183
184
  playlist.addItems(filtered_tracks)
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.2
2
+ Name: plexutil
3
+ Version: 2.0.2
4
+ Author-email: Carlos Florez <carlos@florez.co.uk>
5
+ Maintainer-email: Carlos Florez <carlos@florez.co.uk>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 CARLOS FLOREZ
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Repository, https://github.com/florez-carlos/plexutil
29
+ Classifier: Development Status :: 5 - Production/Stable
30
+ Classifier: Programming Language :: Python :: 3.11
31
+ Requires-Python: >=3.11.6
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: PlexAPI==4.15.7
35
+ Requires-Dist: alive-progress==3.1.5
36
+ Requires-Dist: pyyaml==6.0.1
37
+ Requires-Dist: toml==0.10.2
38
+ Requires-Dist: pywin32==306; sys_platform == "win32"
39
+ Requires-Dist: jsonschema==4.23.0
40
+ Requires-Dist: peewee==3.17.7
41
+ Requires-Dist: colorlog==6.4.0
42
+ Requires-Dist: keyring==25.5.0
43
+ Requires-Dist: cryptography==44.0.0
44
+
45
+ # Plexutil
46
+
47
+ CLI tool with helpful functions to manage a Plex server.
48
+
49
+
50
+ > [!NOTE]
51
+ > Installation is supported only for the following:
52
+ > - Windows
53
+ > - Linux
54
+
55
+ > [!NOTE]
56
+ > Development requires a fully configured [Dotfiles](https://github.com/florez-carlos/dotfiles) dev environment <br>
57
+
58
+ ## Table of Contents
59
+
60
+ * [Installation](#installation)
61
+ * [Configuration](#configuration)
62
+ * [Required](#required)
63
+ * [Optional](#optional)
64
+ * [TV Series Language Override](#tv-series-language-override)
65
+ * [Library Preferences](#library-preferences)
66
+ * [Server Setting Preferences](#server-setting-preferences)
67
+ * [Usage](#usage)
68
+ * [Creating a media library](#creating-a-media-library)
69
+ * [Deleting a media library](#deleting-a-media-library)
70
+ * [Creating a Playlist](#creating-a-playlist)
71
+ * [Deleting a Playlist](#deleting-a-playlist)
72
+ * [Adding songs to a Playlist](#adding-songs-to-a-playlist)
73
+ * [Exporting/Importing Music Playlists](#exportingimporting-music-playlists)
74
+ * [Development](#development)
75
+ * [Config Location](#config-location)
76
+ * [Log Location](#log-location)
77
+
78
+
79
+ ## Installation
80
+
81
+ ```bash
82
+ pip install plexutil
83
+ ```
84
+
85
+ ## Configuration
86
+ ### Required
87
+ Set the host, port, token of your plex server
88
+ ```bash
89
+ plexutil config -host <PLEX_SERVER_HOST> -port <PLEX_SERVER_PORT> -token <PLEX_SERVER_TOKEN>
90
+ ```
91
+ ### Optional
92
+ #### TV Series Language Override
93
+ To override the language of tv series, modify the tv_language_manifest.json file found in: [Config Location](#config-location) <br >
94
+ The file can be modified like such:
95
+ ```bash
96
+ {
97
+ "es-ES": [327417,396583,388477,292262,282670,274522],
98
+ "en-US": []
99
+ }
100
+ ```
101
+ Where the key is the language and the list contains the [TVDB](https://www.thetvdb.com/) ids of the desired series to be overriden <br >
102
+ For a list of supported languages: [Language](./src/plexutil/enums/language.py)
103
+
104
+ ---
105
+
106
+ #### Library Preferences
107
+ Libraries of type:
108
+ - Movie
109
+ - Music
110
+ - TV
111
+
112
+ Can have their preferences set in the following files:
113
+
114
+ - movie_library_preferences.json
115
+ - music_library_preferences.json
116
+ - tv_library_preferences.json
117
+
118
+ These files can be found here: [Config Location](#config-location) <br >
119
+ These Preferences are set at library creation time <br >
120
+ The files already include default preferences that can be removed/modified/added based on your needs <br >
121
+
122
+ ---
123
+
124
+ #### Server Setting Preferences
125
+ These preferences modify the behavior of the server
126
+
127
+ - plex_server_setting_preferences.json
128
+
129
+ The file can be found here: [Config Location](#config-location) <br >
130
+ For example:
131
+ ```json
132
+ "ButlerStartHour": 23,
133
+ ```
134
+ Starts scheduled tasks at 11:00PM local time, to modify this time to 1:00AM
135
+ ```json
136
+ "ButlerStartHour": 1,
137
+ ```
138
+ These modifications need to be set by doing:
139
+ ```bash
140
+ plexutil set_server_settings
141
+ ```
142
+ The file already includes default preferences that can be removed/modified/added based on your needs <br >
143
+
144
+ ---
145
+
146
+ ## Usage
147
+ ### Creating a media library:
148
+ > [!NOTE]
149
+ > If language is not supplied, the default is en-US
150
+ ```bash
151
+ plexutil create_movie_library -libn <NAME_OF_THE_LIBRARY> -loc </PATH/TO/MEDIA/LOCATION> -l <LANGUAGE>
152
+ ```
153
+ ---
154
+
155
+ ### Deleting a media library:
156
+ ```bash
157
+ plexutil delete_movie_library -libn <NAME_OF_THE_LIBRARY>
158
+ ```
159
+ ---
160
+
161
+ ### Creating a Playlist
162
+ > [!NOTE]
163
+ > Only Music Playlists are currently supported
164
+ ```bash
165
+ plexutil create_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLIST_IS> -pn <NAME_OF_THE_PLAYLIST> -s /path/to/song.mp3 /path/to/another-song.mp3
166
+ ```
167
+ > [!NOTE]
168
+ > The paths passed to -s must match the location of the library <br >
169
+ > Therefore, if the library has for location /media/music these song paths must be in /media/music/song.mp3
170
+
171
+ ---
172
+
173
+ ### Deleting a Playlist
174
+ > [!NOTE]
175
+ > Only Music Playlists are currently supported
176
+ ```bash
177
+ plexutil delete_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLIST_IS> -pn <NAME_OF_THE_PLAYLIST>
178
+ ```
179
+
180
+ ---
181
+
182
+ ### Adding songs to a Playlist
183
+
184
+ ```bash
185
+ plexutil add_songs_to_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLIST_IS> -pn <NAME_OF_THE_PLAYLIST> -s /path/to/song.mp3 /path/to/another-song.mp3
186
+ ```
187
+ > [!NOTE]
188
+ > The paths passed to -s must match the location of the library <br >
189
+ > Therefore, if the library has for location /media/music these song paths must be in /media/music/song.mp3
190
+
191
+ ---
192
+
193
+ ### Exporting/Importing Music Playlists
194
+ Music Playlists can be exported to a playlists.db file, this file can later be imported to another Plex server with plexutil
195
+ ```bash
196
+ plexutil export_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLISTS_ARE>
197
+ ```
198
+ This action will create a playlists.db file here: [Config Location](#config-location) <br >
199
+ This file can then be used to recreate the playlists in another Plex Server with plexutil by doing
200
+ ```bash
201
+ plexutil import_music_playlist -libn <LIBRARY_NAME_WHERE_PLAYLISTS_ARE>
202
+ ```
203
+ > [!NOTE]
204
+ > The songs in the Music Library of the importing server must match the songs in the exporting server
205
+
206
+ ---
207
+
208
+ ## Development
209
+ ```bash
210
+ source init.sh
211
+ ```
212
+ ## Config Location
213
+ The config directory of Plexutil is located:
214
+ > [!NOTE]
215
+ > Replace <YOUR_USER> with your Windows UserName
216
+ - Windows
217
+ ```bash
218
+ C:\Users\<YOUR_USER>\Documents\plexutil\config\
219
+ ```
220
+ - Linux
221
+ ```bash
222
+ $HOME/plexutil/config/tv_language_manifest.json
223
+ ```
224
+
225
+ ## Log Location
226
+ The log directory of Plexutil is located:
227
+ > [!NOTE]
228
+ > Replace <YOUR_USER> with your Windows UserName
229
+ - Windows
230
+ ```bash
231
+ C:\Users\<YOUR_USER>\Documents\plexutil\log
232
+ ```
233
+ - Linux
234
+ ```bash
235
+ $HOME/plexutil/log
236
+ ```
237
+ > [!NOTE]
238
+ > Log files are archived based on date, such as yyyy-mm-dd.log
239
+
240
+ ## License
241
+ [MIT](https://choosealicense.com/licenses/mit/)
242
+