@@ -87,19 +87,27 @@ def commands(self) -> list[ui.Subcommand]:
8787 action = "store_true" ,
8888 help = "display query results but don't write playlist files." ,
8989 )
90- spl_update .parser .add_format_option (target = "item" )
90+ spl_update .parser .add_option (
91+ "-f" ,
92+ "--format" ,
93+ type = "string" ,
94+ default = self .config ["format" ].get (),
95+ help = "print per-track log lines with custom format" ,
96+ )
9197 spl_update .parser .add_option (
9298 "-d" ,
9399 "--playlist-dir" ,
94100 dest = "playlist_dir" ,
95101 metavar = "PATH" ,
96102 type = "string" ,
103+ default = self .config ["playlist_dir" ].get (),
97104 help = "directory to write the generated playlist files to." ,
98105 )
99106 spl_update .parser .add_option (
100107 "--dest-regen" ,
101108 action = "store_true" ,
102109 dest = "dest_regen" ,
110+ default = self .config ["dest_regen" ].get (bool ),
103111 help = "regenerate the destination path as 'move' or 'convert' "
104112 "commands would do." ,
105113 )
@@ -108,33 +116,39 @@ def commands(self) -> list[ui.Subcommand]:
108116 dest = "relative_to" ,
109117 metavar = "PATH" ,
110118 type = "string" ,
119+ default = self .config ["relative_to" ].get (),
111120 help = "generate playlist item paths relative to this path." ,
112121 )
113122 spl_update .parser .add_option (
114123 "--prefix" ,
115124 type = "string" ,
125+ default = self .config ["prefix" ].get (),
116126 help = "prepend string to every path in the playlist file." ,
117127 )
118128 spl_update .parser .add_option (
119129 "--forward-slash" ,
120130 action = "store_true" ,
121131 dest = "forward_slash" ,
132+ default = self .config ["forward_slash" ].get (bool ),
122133 help = "force forward slash in paths within playlists." ,
123134 )
124135 spl_update .parser .add_option (
125136 "--urlencode" ,
126137 action = "store_true" ,
138+ default = self .config ["urlencode" ].get (bool ),
127139 help = "URL-encode all paths." ,
128140 )
129141 spl_update .parser .add_option (
130142 "--uri-format" ,
131143 dest = "uri_format" ,
132144 type = "string" ,
145+ default = self .config ["uri_format" ].get (),
133146 help = "playlist item URI template, e.g. http://beets:8337/item/$id/file." ,
134147 )
135148 spl_update .parser .add_option (
136149 "--output" ,
137150 type = "string" ,
151+ default = self .config ["output" ].get (),
138152 help = "specify the playlist format: m3u|extm3u." ,
139153 )
140154 spl_update .func = self .update_cmd
@@ -166,14 +180,9 @@ def update_cmd(self, lib: Library, opts: Any, args: list[str]) -> None:
166180 else :
167181 self ._matched_playlists = self ._unmatched_playlists
168182
169- self .__apply_opts_to_config ( opts )
183+ self .config . set ( vars ( opts ) )
170184 self .update_playlists (lib , opts .pretend )
171185
172- def __apply_opts_to_config (self , opts : Any ) -> None :
173- for k , v in opts .__dict__ .items ():
174- if v is not None and k in self .config :
175- self .config [k ] = v
176-
177186 def _parse_one_query (
178187 self , playlist : dict [str , Any ], key : str , model_cls : type
179188 ) -> tuple [PlaylistQuery , Sort | None ]:
0 commit comments