From 205c5493db1fc7ef067aaa4571670ac1e451b767 Mon Sep 17 00:00:00 2001 From: broquemonsieur Date: Sun, 6 Aug 2023 10:35:53 -0700 Subject: [PATCH] Replace EOF carriage returns --- .gitignore | 2 +- docker-compose.yml | 2 +- docker/init-invidious-db.sh | 2 +- src/invidious/compilations.cr | 20 ++++++++++--------- src/invidious/views/add_compilation_items.ecr | 2 +- .../views/components/compilation_video.ecr | 2 +- src/invidious/views/components/feed_menu.ecr | 2 +- src/invidious/views/feeds/compilations.ecr | 2 +- 8 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 2a49e68d..f36ac1ee 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ /invidious /sentry /config/config.yml -.DS_Store \ No newline at end of file +.DS_Store diff --git a/docker-compose.yml b/docker-compose.yml index 854d2051..6a854475 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -54,4 +54,4 @@ services: test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] volumes: - postgresdata: \ No newline at end of file + postgresdata: diff --git a/docker/init-invidious-db.sh b/docker/init-invidious-db.sh index 62df4229..f7fe3e7f 100755 --- a/docker/init-invidious-db.sh +++ b/docker/init-invidious-db.sh @@ -11,4 +11,4 @@ psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/annotation psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlists.sql psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlist_videos.sql psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/compilations.sql -psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/compilation_videos.sql \ No newline at end of file +psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/compilation_videos.sql diff --git a/src/invidious/compilations.cr b/src/invidious/compilations.cr index d2dc4e16..929a5fbd 100644 --- a/src/invidious/compilations.cr +++ b/src/invidious/compilations.cr @@ -339,16 +339,18 @@ end def update_first_video_params(compid : String) if compilation = Invidious::Database::Compilations.select(id: compid) compilation_index_array = compilation.index - first_index = compilation_index_array[0] - first_id = Invidious::Database::CompilationVideos.select_id_from_index(first_index) - if !first_id.nil? - timestamps = Invidious::Database::CompilationVideos.select_timestamps(compid, first_id) - if (!timestamps.nil?) - starting_timestamp_seconds=timestamps[0] - ending_timestamp_seconds=timestamps[1] - Invidious::Database::Compilations.update_first_video_params(compid, first_id, starting_timestamp_seconds, ending_timestamp_seconds) + if (compilation_index_array.size > 0) + first_index = compilation_index_array[0] + first_id = Invidious::Database::CompilationVideos.select_id_from_index(first_index) + if !first_id.nil? + timestamps = Invidious::Database::CompilationVideos.select_timestamps(compid, first_id) + if (!timestamps.nil?) + starting_timestamp_seconds=timestamps[0] + ending_timestamp_seconds=timestamps[1] + Invidious::Database::Compilations.update_first_video_params(compid, first_id, starting_timestamp_seconds, ending_timestamp_seconds) + end end - end + end else raise NotFoundException.new("Compilation does not exist.") end diff --git a/src/invidious/views/add_compilation_items.ecr b/src/invidious/views/add_compilation_items.ecr index 3fbb5d96..e62e860c 100644 --- a/src/invidious/views/add_compilation_items.ecr +++ b/src/invidious/views/add_compilation_items.ecr @@ -31,4 +31,4 @@ -<%= rendered "components/items_paginated" %> \ No newline at end of file +<%= rendered "components/items_paginated" %> diff --git a/src/invidious/views/components/compilation_video.ecr b/src/invidious/views/components/compilation_video.ecr index eab9d48a..cca1f5cb 100644 --- a/src/invidious/views/components/compilation_video.ecr +++ b/src/invidious/views/components/compilation_video.ecr @@ -40,4 +40,4 @@ - \ No newline at end of file + diff --git a/src/invidious/views/components/feed_menu.ecr b/src/invidious/views/components/feed_menu.ecr index ff3b2474..180a263f 100644 --- a/src/invidious/views/components/feed_menu.ecr +++ b/src/invidious/views/components/feed_menu.ecr @@ -8,4 +8,4 @@ <%= translate(locale, feed) %> <% end %> - \ No newline at end of file + diff --git a/src/invidious/views/feeds/compilations.ecr b/src/invidious/views/feeds/compilations.ecr index 31d073c4..7e56dd93 100644 --- a/src/invidious/views/feeds/compilations.ecr +++ b/src/invidious/views/feeds/compilations.ecr @@ -26,4 +26,4 @@ <% items_created.each do |item| %> <%= rendered "components/item" %> <% end %> - \ No newline at end of file +