File tree Expand file tree Collapse file tree 7 files changed +24
-1
lines changed Expand file tree Collapse file tree 7 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 122122 "Redirect homepage to feed: " : " Redirect homepage to feed: " ,
123123 "preferences_max_results_label" : " Number of videos shown in feed: " ,
124124 "preferences_sort_label" : " Sort videos by: " ,
125+ "preferences_default_playlist" : " Default playlist: " ,
126+ "preferences_default_playlist_none" : " No default playlist set" ,
125127 "published" : " published" ,
126128 "published - reverse" : " published - reverse" ,
127129 "alphabetically" : " alphabetically" ,
Original file line number Diff line number Diff line change 7878 "Redirect homepage to feed: " : " Redirigir la página de inicio a la fuente: " ,
7979 "preferences_max_results_label" : " Número de videos mostrados en la fuente: " ,
8080 "preferences_sort_label" : " Ordenar los videos por: " ,
81+ "preferences_default_playlist" : " Lista de reproducción por defecto: " ,
82+ "preferences_default_playlist_none" : " Ninguna lista de reproducción por defecto establecida" ,
8183 "published" : " fecha de publicación" ,
8284 "published - reverse" : " fecha de publicación: orden inverso" ,
8385 "alphabetically" : " alfabéticamente" ,
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ struct ConfigPreferences
5252 property vr_mode : Bool = true
5353 property show_nick : Bool = true
5454 property save_player_pos : Bool = false
55+ @[YAML ::Field (ignore: true )]
56+ property default_playlist : String ? = nil
5557
5658 def to_tuple
5759 {% begin % }
Original file line number Diff line number Diff line change @@ -144,6 +144,8 @@ module Invidious::Routes::PreferencesRoute
144144 notifications_only ||= " off"
145145 notifications_only = notifications_only == " on"
146146
147+ default_playlist = env.params.body[" default_playlist" ]?.try & .as(String )
148+
147149 # Convert to JSON and back again to take advantage of converters used for compatibility
148150 preferences = Preferences .from_json({
149151 annotations: annotations,
@@ -180,6 +182,7 @@ module Invidious::Routes::PreferencesRoute
180182 vr_mode: vr_mode,
181183 show_nick: show_nick,
182184 save_player_pos: save_player_pos,
185+ default_playlist: default_playlist,
183186 }.to_json)
184187
185188 if user = env.get? " user"
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ struct Preferences
5656 property extend_desc : Bool = CONFIG .default_user_preferences.extend_desc
5757 property volume : Int32 = CONFIG .default_user_preferences.volume
5858 property save_player_pos : Bool = CONFIG .default_user_preferences.save_player_pos
59+ property default_playlist : String ? = nil
5960
6061 module BoolToString
6162 def self.to_json (value : String , json : JSON ::Builder )
Original file line number Diff line number Diff line change 126126 <input name =" save_player_pos" id =" save_player_pos" type =" checkbox" <% if preferences.save_player_pos %> checked <% end %> >
127127 </div >
128128
129+ <% if user = env.get?(" user" ).try & .as(User ) %>
130+ <% playlists = Invidious ::Database ::Playlists .select_user_created_playlists(user.email) %>
131+ <div class =" pure-control-group" >
132+ <label for =" default_playlist" ><%= translate(locale, " preferences_default_playlist" ) %> </label >
133+ <select name =" default_playlist" id =" default_playlist" >
134+ <option value =" " ><%= translate(locale, " preferences_default_playlist_none" ) %> </option >
135+ <% playlists.each do |plid , playlist_title | %>
136+ <option value =" <%= plid %> " <%= " selected" if user.preferences.default_playlist == plid %> ><%= HTML .escape(playlist_title) %> </option >
137+ <% end %>
138+ </select >
139+ </div >
140+ <% end %>
141+
129142 <legend ><%= translate(locale, " preferences_category_visual" ) %> </legend >
130143
131144 <div class =" pure-control-group" >
Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ we're going to need to do it here in order to allow for translations.
163163 < label for = " playlist_id" >< %= translate (locale, " Add to playlist: " ) % >< / label>
164164 < select style= " width:100%" name= " playlist_id" id= " playlist_id" >
165165 < % playlists .each do | plid, playlist_title| % >
166- < option data- plid= " <%= plid %> " value= " <%= plid %> " >< %= HTML .escape (playlist_title) % >< / option>
166+ < option data- plid= " <%= plid %> " value= " <%= plid %> " < %= " selected " if user . preferences . default_playlist == plid % > >< %= HTML .escape (playlist_title) % >< / option>
167167 < % end % >
168168 < / select>
169169 < / div>
You can’t perform that action at this time.
0 commit comments