Skip to content

Commit

Permalink
fixed nightly thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
MilchRatchet committed Oct 3, 2020
1 parent d3f2258 commit 30da852
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion SubBox/Models/Downloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public static void DownloadVideo(string id)

const char quote = '\u0022';

dl.StartInfo.Arguments = $@"-f " + quote + $@"bestvideo[height<={height}][fps<={fps}][ext=webm]+bestaudio[ext=webm]/bestvideo[height<={height}][fps<={fps}][ext=mp4]+bestaudio[ext=m4a]/webm/mp4" + quote + $@" -o wwwroot/Videos/%(channel_id)s&%(uploader)s/%(id)s&%(title)s --restrict-filenames --write-all-thumbnails https://www.youtube.com/watch?v={id}";
dl.StartInfo.Arguments = $@"-f " + quote + $@"bestvideo[height<={height}][fps<={fps}][ext=webm]+bestaudio[ext=webm]/bestvideo[height<={height}][fps<={fps}][ext=mp4]+bestaudio[ext=m4a]/webm/mp4" + quote + $@" -o wwwroot/Videos/%(channel_id)s&%(uploader)s/%(id)s&%(title)s --restrict-filenames --write-thumbnail https://www.youtube.com/watch?v={id}";

dl.StartInfo.UseShellExecute = false;

Expand Down
5 changes: 2 additions & 3 deletions SubBox/Models/LocalCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static void CollectAllDownloadedVideos()

mp4Files = null;

string[] jpgFiles = Directory.GetFiles(@"wwwroot\Videos", "*.jpg", SearchOption.AllDirectories);
string[] webpFiles = Directory.GetFiles(@"wwwroot\Videos", "*.webp", SearchOption.AllDirectories);

foreach (string file in videoFiles)
{
Expand All @@ -79,7 +79,7 @@ public static void CollectAllDownloadedVideos()

string thumbDir = "";

foreach (string thumb in jpgFiles)
foreach (string thumb in webpFiles)
{
string thumbId = thumb.Split('\\')[3].Split('&')[0];

Expand Down Expand Up @@ -188,7 +188,6 @@ public static void CollectAllDownloadedVideos()
Logger.Error(e.Message);
}


LocalVideo lv = new LocalVideo()
{
Data = video,
Expand Down
6 changes: 3 additions & 3 deletions SubBox/wwwroot/js/localbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ var app = new Vue({

return null;
},
switchToLocalThumb(video, event) {
video.Value.onlineThumbUrl = video.Value.thumbDir;
switchToOnlineThumb(video, event) {
video.Value.thumbDir = video.Value.onlineThumbUrl;

event = event || window.event;

const target = event.target || event.srcElement;

target.src = video.Value.onlineThumbUrl;
target.src = video.Value.thumbDir;
},
},
el: "#app",
Expand Down
2 changes: 1 addition & 1 deletion SubBox/wwwroot/localbrowser.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class="grid">
<div v-for="video in filteredVideos" class="gridVideo" >
<div class="videoThumbDiv" @click="select(video)">
<img class="videoThumb" :src="video.Value.onlineThumbUrl" @error="switchToLocalThumb(video, $event)" />
<img class="videoThumb" :src="video.Value.thumbDir" @error="switchToOnlineThumb(video, $event)" />
<p class="videoThumbDuration" v-if="video.Value.data.duration !== 'NULL'">{{video.Value.data.duration}}</p>
</div>

Expand Down

0 comments on commit 30da852

Please sign in to comment.