mirror of
https://github.com/iv-org/invidious.git
synced 2025-09-15 00:08:30 +00:00
Add default playlist preference
Closes https://github.com/iv-org/invidious/issues/5421
This commit is contained in:
parent
fd8dc93569
commit
ba45015393
@ -122,6 +122,7 @@
|
|||||||
"Redirect homepage to feed: ": "Redirect homepage to feed: ",
|
"Redirect homepage to feed: ": "Redirect homepage to feed: ",
|
||||||
"preferences_max_results_label": "Number of videos shown in feed: ",
|
"preferences_max_results_label": "Number of videos shown in feed: ",
|
||||||
"preferences_sort_label": "Sort videos by: ",
|
"preferences_sort_label": "Sort videos by: ",
|
||||||
|
"preferences_default_playlist": "Default playlist: ",
|
||||||
"published": "published",
|
"published": "published",
|
||||||
"published - reverse": "published - reverse",
|
"published - reverse": "published - reverse",
|
||||||
"alphabetically": "alphabetically",
|
"alphabetically": "alphabetically",
|
||||||
|
@ -78,6 +78,7 @@
|
|||||||
"Redirect homepage to feed: ": "Redirigir la página de inicio a la fuente: ",
|
"Redirect homepage to feed: ": "Redirigir la página de inicio a la fuente: ",
|
||||||
"preferences_max_results_label": "Número de videos mostrados en la fuente: ",
|
"preferences_max_results_label": "Número de videos mostrados en la fuente: ",
|
||||||
"preferences_sort_label": "Ordenar los videos por: ",
|
"preferences_sort_label": "Ordenar los videos por: ",
|
||||||
|
"preferences_default_playlist": "Lista de reproducción por defecto: ",
|
||||||
"published": "fecha de publicación",
|
"published": "fecha de publicación",
|
||||||
"published - reverse": "fecha de publicación: orden inverso",
|
"published - reverse": "fecha de publicación: orden inverso",
|
||||||
"alphabetically": "alfabéticamente",
|
"alphabetically": "alfabéticamente",
|
||||||
|
@ -52,6 +52,8 @@ struct ConfigPreferences
|
|||||||
property vr_mode : Bool = true
|
property vr_mode : Bool = true
|
||||||
property show_nick : Bool = true
|
property show_nick : Bool = true
|
||||||
property save_player_pos : Bool = false
|
property save_player_pos : Bool = false
|
||||||
|
@[YAML::Field(ignore: true)]
|
||||||
|
property default_playlist : String? = nil
|
||||||
|
|
||||||
def to_tuple
|
def to_tuple
|
||||||
{% begin %}
|
{% begin %}
|
||||||
|
@ -144,6 +144,8 @@ module Invidious::Routes::PreferencesRoute
|
|||||||
notifications_only ||= "off"
|
notifications_only ||= "off"
|
||||||
notifications_only = notifications_only == "on"
|
notifications_only = notifications_only == "on"
|
||||||
|
|
||||||
|
default_playlist = env.params.body["default_playlist"]?.try &.as(String)
|
||||||
|
|
||||||
# Convert to JSON and back again to take advantage of converters used for compatibility
|
# Convert to JSON and back again to take advantage of converters used for compatibility
|
||||||
preferences = Preferences.from_json({
|
preferences = Preferences.from_json({
|
||||||
annotations: annotations,
|
annotations: annotations,
|
||||||
@ -180,6 +182,7 @@ module Invidious::Routes::PreferencesRoute
|
|||||||
vr_mode: vr_mode,
|
vr_mode: vr_mode,
|
||||||
show_nick: show_nick,
|
show_nick: show_nick,
|
||||||
save_player_pos: save_player_pos,
|
save_player_pos: save_player_pos,
|
||||||
|
default_playlist: default_playlist,
|
||||||
}.to_json)
|
}.to_json)
|
||||||
|
|
||||||
if user = env.get? "user"
|
if user = env.get? "user"
|
||||||
|
@ -56,6 +56,7 @@ struct Preferences
|
|||||||
property extend_desc : Bool = CONFIG.default_user_preferences.extend_desc
|
property extend_desc : Bool = CONFIG.default_user_preferences.extend_desc
|
||||||
property volume : Int32 = CONFIG.default_user_preferences.volume
|
property volume : Int32 = CONFIG.default_user_preferences.volume
|
||||||
property save_player_pos : Bool = CONFIG.default_user_preferences.save_player_pos
|
property save_player_pos : Bool = CONFIG.default_user_preferences.save_player_pos
|
||||||
|
property default_playlist : String? = nil
|
||||||
|
|
||||||
module BoolToString
|
module BoolToString
|
||||||
def self.to_json(value : String, json : JSON::Builder)
|
def self.to_json(value : String, json : JSON::Builder)
|
||||||
|
@ -208,6 +208,18 @@
|
|||||||
<input name="automatic_instance_redirect" id="automatic_instance_redirect" type="checkbox" <% if preferences.automatic_instance_redirect %>checked<% end %>>
|
<input name="automatic_instance_redirect" id="automatic_instance_redirect" type="checkbox" <% if preferences.automatic_instance_redirect %>checked<% end %>>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% if user = env.get?("user").as(User) %>
|
||||||
|
<% playlists = Invidious::Database::Playlists.select_user_created_playlists(user.email) %>
|
||||||
|
<div class="pure-control-group">
|
||||||
|
<label for="default_playlist"><%= translate(locale, "preferences_default_playlist") %></label>
|
||||||
|
<select name="default_playlist" id="default_playlist">
|
||||||
|
<% playlists.each do |plid, playlist_title| %>
|
||||||
|
<option value="<%= plid %>" <%= "selected" if user.preferences.default_playlist == plid %>><%= HTML.escape(playlist_title) %></option>
|
||||||
|
<% end %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if env.get? "user" %>
|
<% if env.get? "user" %>
|
||||||
<legend><%= translate(locale, "preferences_category_subscription") %></legend>
|
<legend><%= translate(locale, "preferences_category_subscription") %></legend>
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ we're going to need to do it here in order to allow for translations.
|
|||||||
<label for="playlist_id"><%= translate(locale, "Add to playlist: ") %></label>
|
<label for="playlist_id"><%= translate(locale, "Add to playlist: ") %></label>
|
||||||
<select style="width:100%" name="playlist_id" id="playlist_id">
|
<select style="width:100%" name="playlist_id" id="playlist_id">
|
||||||
<% playlists.each do |plid, playlist_title| %>
|
<% playlists.each do |plid, playlist_title| %>
|
||||||
<option data-plid="<%= plid %>" value="<%= plid %>"><%= HTML.escape(playlist_title) %></option>
|
<option data-plid="<%= plid %>" value="<%= plid %>" <%= "selected" if user.preferences.default_playlist == plid %>><%= HTML.escape(playlist_title) %></option>
|
||||||
<% end %>
|
<% end %>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user