GUI Functionality

This commit is contained in:
Leon Etienne (ubuntu wsl) 2020-09-30 20:57:12 +02:00
parent ad7eac5343
commit c33216f2dd
40 changed files with 4727 additions and 44 deletions

View File

@ -150,7 +150,7 @@ void DownloadManager::DownloadNext()
if (entry->mode == DOWNLOAD_MODE::VIDEO) if (entry->mode == DOWNLOAD_MODE::VIDEO)
{ {
std::string ytdl_call_video_base = std::string ytdl_call_video_base =
"youtube-dl --newline --no-call-home --no-playlist --no-part --no-warnings --limit-rate $$DL_RATE" "youtube-dl --newline --no-call-home --no-playlist --no-part --no-warnings --socket-timeout 5 --limit-rate $$DL_RATE"
" --no-mtime --no-cache-dir --recode-video mp4 --format \"bestvideo[ext=mp4]+bestaudio/best[ext=mp4]/best\"" " --no-mtime --no-cache-dir --recode-video mp4 --format \"bestvideo[ext=mp4]+bestaudio/best[ext=mp4]/best\""
" --merge-output-format mp4 -o \"$$DL_FILE\" \"$$DL_URL\" > \"$$DL_PROG_BUF_FILE\""; " --merge-output-format mp4 -o \"$$DL_FILE\" \"$$DL_URL\" > \"$$DL_PROG_BUF_FILE\"";
@ -166,7 +166,7 @@ void DownloadManager::DownloadNext()
else // DOWNLOAD_MODE::AUDIO else // DOWNLOAD_MODE::AUDIO
{ {
std::string ytdl_call_audio_base = std::string ytdl_call_audio_base =
"youtube-dl --newline --no-call-home --no-playlist --no-part --no-warnings --limit-rate $$DL_RATE" "youtube-dl --newline --no-call-home --no-playlist --no-part --no-warnings --socket-timeout 5 --limit-rate $$DL_RATE"
" --no-mtime --no-cache-dir --audio-format mp3 --audio-quality 0 --extract-audio -o \"$$DL_FILE\"" " --no-mtime --no-cache-dir --audio-format mp3 --audio-quality 0 --extract-audio -o \"$$DL_FILE\""
" \"$$DL_URL\" > \"$$DL_PROG_BUF_FILE\""; " \"$$DL_URL\" > \"$$DL_PROG_BUF_FILE\"";
@ -405,7 +405,8 @@ bool DownloadManager::RemoveFromCacheByID(std::string id)
FileSystem::Delete(filePath); FileSystem::Delete(filePath);
} }
Save(); // Only save, if we can save immediately
if (downloadThreads.size() == 0) Save();
return false; return false;
} }
@ -573,7 +574,7 @@ std::vector<DownloadEntry> DownloadManager::ParseJsonArrayToEntries(const JasonP
void DownloadManager::FetchInformation(std::string url, std::string tubId) void DownloadManager::FetchInformation(std::string url, std::string tubId)
{ {
std::stringstream ss; std::stringstream ss;
ss << "youtube-dl.exe --skip-download --dump-json \"" << url << "\" > \"" << XGConfig::downloader.cachedir << "/metadata/" << tubId << ".json" << "\"" << std::endl; ss << "youtube-dl.exe --skip-download --no-warnings --socket-timeout 5 --dump-json \"" << url << "\" > \"" << XGConfig::downloader.cachedir << "/metadata/" << tubId << ".json" << "\"" << std::endl;
system(ss.str().c_str()); system(ss.str().c_str());
return; return;
} }

View File

@ -106,8 +106,8 @@ bool RestQueryHandler::QueueDownload(const JsonBlock& request, JsonBlock& respon
bool RestQueryHandler::FetchSessionCache(const JsonBlock& request, JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode) bool RestQueryHandler::FetchSessionCache(const JsonBlock& request, JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode)
{ {
log->cout << "Asking for session cache..."; //log->cout << "Asking for session cache...";
log->Flush(); //log->Flush();
time_t max_age = time(0) - XGControl::boot_time; // Default max_age is session length time_t max_age = time(0) - XGControl::boot_time; // Default max_age is session length
std::size_t max_num = (std::size_t )-1; // Default max_num is infinite std::size_t max_num = (std::size_t )-1; // Default max_num is infinite
@ -137,8 +137,8 @@ bool RestQueryHandler::FetchSessionCache(const JsonBlock& request, JsonBlock& re
bool RestQueryHandler::FetchAlltimeCache(const JsonBlock& request, JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode) bool RestQueryHandler::FetchAlltimeCache(const JsonBlock& request, JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode)
{ {
log->cout << "Asking for whole cache..."; //log->cout << "Asking for whole cache...";
log->Flush(); //log->Flush();
responseCode = OK; responseCode = OK;
responseBody.CloneFrom(RestResponseTemplates::GetByCode(OK)); responseBody.CloneFrom(RestResponseTemplates::GetByCode(OK));
@ -254,8 +254,8 @@ bool RestQueryHandler::GetOSName(const JsonBlock& request, JsonBlock& responseBo
bool RestQueryHandler::FetchSessionLogs(const JsonBlock& request, JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode) bool RestQueryHandler::FetchSessionLogs(const JsonBlock& request, JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode)
{ {
log->cout << "Fetching session logs..."; //log->cout << "Fetching session logs...";
log->Flush(); //log->Flush();
responseCode = OK; responseCode = OK;
responseBody.CloneFrom(RestResponseTemplates::GetByCode(OK)); responseBody.CloneFrom(RestResponseTemplates::GetByCode(OK));
@ -267,8 +267,8 @@ bool RestQueryHandler::FetchSessionLogs(const JsonBlock& request, JsonBlock& res
bool RestQueryHandler::FetchAlltimeLogs(const JsonBlock& request, JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode) bool RestQueryHandler::FetchAlltimeLogs(const JsonBlock& request, JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode)
{ {
log->cout << "Fetching logs..."; //log->cout << "Fetching alltime logs...";
log->Flush(); //log->Flush();
time_t max_age = -1; time_t max_age = -1;
std::size_t max_num = (std::size_t) - 1; std::size_t max_num = (std::size_t) - 1;

0
Tubio/frontend/.nojekyll Normal file
View File

9
Tubio/frontend/200.html Normal file
View File

@ -0,0 +1,9 @@
<!doctype html>
<html>
<head>
<title>Tubio - Video downloader</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="description" name="description" content=""><link data-n-head="1" rel="icon" type="image/x-icon" href="/favicon.ico"><link rel="preload" href="/_nuxt/5104fab.js" as="script"><link rel="preload" href="/_nuxt/9ba7375.js" as="script"><link rel="preload" href="/_nuxt/44d19af.js" as="script"><link rel="preload" href="/_nuxt/3545cee.js" as="script">
</head>
<body>
<div id="__nuxt"><style>#nuxt-loading{background:#fff;visibility:hidden;opacity:0;position:absolute;left:0;right:0;top:0;bottom:0;display:flex;justify-content:center;align-items:center;flex-direction:column;animation:nuxtLoadingIn 10s ease;-webkit-animation:nuxtLoadingIn 10s ease;animation-fill-mode:forwards;overflow:hidden}@keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}@-webkit-keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}#nuxt-loading>div,#nuxt-loading>div:after{border-radius:50%;width:5rem;height:5rem}#nuxt-loading>div{font-size:10px;position:relative;text-indent:-9999em;border:.5rem solid #f5f5f5;border-left:.5rem solid #000;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:nuxtLoading 1.1s infinite linear;animation:nuxtLoading 1.1s infinite linear}#nuxt-loading.error>div{border-left:.5rem solid #ff4500;animation-duration:5s}@-webkit-keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}</style><script>window.addEventListener("error",function(){var e=document.getElementById("nuxt-loading");e&&(e.className+=" error")})</script><div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div></div><script>window.__NUXT__={config:{},staticAssetsBase:"/_nuxt/static/1601491529"}</script>
<script src="/_nuxt/5104fab.js"></script><script src="/_nuxt/9ba7375.js"></script><script src="/_nuxt/44d19af.js"></script><script src="/_nuxt/3545cee.js"></script></body>
</html>

11
Tubio/frontend/README.md Normal file
View File

@ -0,0 +1,11 @@
# STATIC
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your static files.
Each file inside this directory is mapped to `/`.
Thus you'd want to delete this README.md before deploying to production.
Example: `/static/robots.txt` is mapped as `/robots.txt`.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static).

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(e){function r(data){for(var r,n,l=data[0],f=data[1],d=data[2],i=0,h=[];i<l.length;i++)n=l[i],Object.prototype.hasOwnProperty.call(o,n)&&o[n]&&h.push(o[n][0]),o[n]=0;for(r in f)Object.prototype.hasOwnProperty.call(f,r)&&(e[r]=f[r]);for(v&&v(data);h.length;)h.shift()();return c.push.apply(c,d||[]),t()}function t(){for(var e,i=0;i<c.length;i++){for(var r=c[i],t=!0,n=1;n<r.length;n++){var f=r[n];0!==o[f]&&(t=!1)}t&&(c.splice(i--,1),e=l(l.s=r[0]))}return e}var n={},o={4:0},c=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var c,script=document.createElement("script");script.charset="utf-8",script.timeout=120,l.nc&&script.setAttribute("nonce",l.nc),script.src=function(e){return l.p+""+{2:"ab89623",3:"9898305"}[e]+".js"}(e);var f=new Error;c=function(r){script.onerror=script.onload=null,clearTimeout(d);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+c+")",f.name="ChunkLoadError",f.type=n,f.request=c,t[1](f)}o[e]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:script})}),12e4);script.onerror=script.onload=c,document.head.appendChild(script)}return Promise.all(r)},l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(object,e){return Object.prototype.hasOwnProperty.call(object,e)},l.p="/_nuxt/",l.oe=function(e){throw console.error(e),e};var f=window.webpackJsonp=window.webpackJsonp||[],d=f.push.bind(f);f.push=r,f=f.slice();for(var i=0;i<f.length;i++)r(f[i]);var v=d;t()}([]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,29 @@
/*!
* vue-router v3.4.5
* (c) 2020 Evan You
* @license MIT
*/
/*!
* Vue.js v2.6.12
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
/*!
* vue-client-only v2.0.0
* (c) 2019-present egoist <0x142857@gmail.com>
* Released under the MIT License.
*/
/*!
* vue-no-ssr v1.1.1
* (c) 2018-present egoist <0x142857@gmail.com>
* Released under the MIT License.
*/
/*!
* vuex v3.5.1
* (c) 2020 Evan You
* @license MIT
*/

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
__NUXT_JSONP__("/", {data:[{}],fetch:[],mutations:[]});

View File

@ -0,0 +1 @@
__NUXT_JSONP__("/settings", {data:[{}],fetch:[],mutations:[]});

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

BIN
Tubio/frontend/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,66 @@
{
"cache": [
{
"description": "Download Eminem's 'MMLP2' Album on iTunes now:http://smarturl.it/MMLP2\n\nCredits below\nVideo Director: Rich Lee\nVideo Producer: Justin Diener\nVideo Producer: Kathy Angstadt\n\nPlaylist Best of Eminem: https://goo.gl/AquNpo\nSubscribe for more: https://goo.gl/DxCrDV\n\n#Eminem #RapGod #Vevo",
"download_progress": 0,
"download_url": "/download/1KnEwh",
"downloaded_filename": "",
"duration": 369,
"mode": "video",
"queued_timestamp": 1601481597,
"status": "queued",
"thumbnail_url": "https://i.ytimg.com/vi/XbGs_qK2PQA/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLCNO4b_zqnDZVdwf7GpJ1i0TEEvJA",
"title": "Eminem - Rap God (Explicit) [Official Video]",
"tubio_id": "1KnEwh",
"uploader": "EminemVEVO",
"webpage_url": "https://www.youtube.com/watch?v=XbGs_qK2PQA"
},
{
"description": "Check out my SoundCloud Channel for more music: https://soundcloud.com/user-411907790\n\u266c \u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u266c \nA big thank you to everyone who voluntarily financially supports my work and thus makes it possible:\n\u26abPaypal: https://www.paypal.me/KarlSternau\n\u26abPatreon: https://www.patreon.com/karlsternau\n\u266c \u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012 \u266c",
"download_progress": 98,
"download_url": "/download/1KnEwb",
"downloaded_filename": "dlcache/download/1KnEwb.mp4",
"duration": 413,
"mode": "video",
"queued_timestamp": 1601481591,
"status": "downloading",
"thumbnail_url": "https://i.ytimg.com/vi/c3wRzxiQ8Zk/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLC4MWTAc7sY5uF6hFzNk2D0tawTSA",
"title": "Sing with Karl - Des Morgens Um Halb Viere [Old soldier and student way][All Stanzas]",
"tubio_id": "1KnEwb",
"uploader": "Karl Sternau",
"webpage_url": "https://www.youtube.com/watch?v=c3wRzxiQ8Zk"
},
{
"description": "Latest video off of Lil Dicky's debut album \"Professional Rapper.\" Download the album here: http://smarturl.it/LilDickyiTunes \n\nWatch Lil Dicky create the most epic rap video, all while he $aves Dat Money! Click here for the documentary: https://www.youtube.com/watch?v=zkXpb20b-NQ\n\nDirector\nTony Yacenda\nwww.TonyYacenda.com\n\nProducer\nJim Cummings\n\nCinematographer\nAlan Gwizdowski\n\nMusic Video Editor\nBrian Vannucci\n\nDocumentary Editor\nBrad Allen Wilde\n\nPost Supervisor\nRyan Ross\n\nColorist\nSean Wells\n\nSound Mixers\nDi Le\nDarrell Tung\n\nSecond Unit DPs\nAdam Lee\nJeff Kulig\nLuc Delamare\n\nBoat Girls\nMelissa Soria\nSuzanne Quast\nJulia Misaki\n\nSpecial Thanks\n\"The Study\u201d Hollywood\nAvilaVIP\nMrs. \u201cK\u201d\nThe Noho Diner\nFrosty Treats/Amp Entertainment\n\nWeedmaps\nMaster and Dynamic\nRGF Productions\nJash\nMeUndies (www.meundies.com)\n\nand\n\nSarah Silverman\nKevin Durant\nDillon Francis\nHannibal Buress\nAbbi Jacobson\nIlana Glazer\nMark Cuban\nTom Petty\n\nSong produced by Money Alwayz\nSong Mixed by Rob Kinelski at The Fortress of Amplitude\nAssistant Engineer: David Baker",
"download_progress": 100,
"download_url": "/download/1KnEw2",
"downloaded_filename": "dlcache/download/1KnEw2.mp4",
"duration": 528,
"mode": "video",
"queued_timestamp": 1601481583,
"status": "finished",
"thumbnail_url": "https://i.ytimg.com/vi/yvHYWD29ZNY/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLAEDvLcxoI0aEQ_gYmFwJJN_4Zpyg",
"title": "Lil Dicky - $ave Dat Money feat. Fetty Wap and Rich Homie Quan (Official Music Video)",
"tubio_id": "1KnEw2",
"uploader": "Lil Dicky",
"webpage_url": "https://www.youtube.com/watch?v=yvHYWD29ZNY"
},
{
"description": "Get the new album \"Wintersaga\" here: https://smarturl.it/Wintersaga-NPR\n\nWind Rose states:\n\u201cMining is one of the most important activities for a Dwarf, naturally Wind Rose needed a theme song for this great honor of collecting these jewels from the soil, so sing with us with pride!!\u201c \n\n\"Diggy Diggy Hole\" originally written by Yogscast\n\nMixed and Mastered by Lasse Lammert",
"download_progress": 9,
"download_url": "/download/1KnEvV",
"downloaded_filename": "dlcache/download/1KnEvV.mp4",
"duration": 341,
"mode": "video",
"queued_timestamp": 1601481574,
"status": "failed",
"thumbnail_url": "https://i.ytimg.com/vi/34CZjsEI1yU/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLBW5B03ohHsKIrdYgJRvSAQNyRNqQ",
"title": "WIND ROSE - Diggy Diggy Hole (Official Video) | Napalm Records",
"tubio_id": "1KnEvV",
"uploader": "Napalm Records",
"webpage_url": "https://www.youtube.com/watch?v=34CZjsEI1yU"
}
],
"cache_size": 4,
"status": "OK"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
v10.19.0

View File

@ -2,7 +2,7 @@
<div class="download-box"> <div class="download-box">
<h2 v-if="false" class="no-dls-yet mt-2">No downloads yet...</h2> <h2 v-if="false" class="no-dls-yet mt-2">No downloads yet...</h2>
<DownloadEntry v-for="(nObj, nIdx) in downloads_c" :downloadEntry="nObj" :key="nIdx" /> <DownloadEntry v-for="(nObj, nIdx) in dlcache" :downloadEntry="nObj" :key="nIdx" />
</div> </div>
</template> </template>
@ -17,8 +17,8 @@ export default {
}, },
computed: { computed: {
downloads_c: function() { dlcache: function() {
return this.downloads; return this.$store.state.dlcache.cache;
} }
}, },
@ -30,15 +30,10 @@ export default {
mounted() { mounted() {
const that = this; const that = this;
axios.get("/rest-dummies/cache.json", { this.$store.dispatch("dlcache/update", this);
responseType: 'text' setInterval(function(){
}).then(function(response){ that.$store.dispatch("dlcache/update", that);
if (response.data.status === "OK") { }, 1000);
console.log(response.data);
that.downloads = response.data.cache;
}
});
return; return;
} }

View File

@ -15,7 +15,7 @@
</div> </div>
</div> </div>
<div class="button-remove"> <div class="button-remove" v-on:click="removeDownload">
<IconX /> <IconX />
</div> </div>
</div> </div>
@ -65,15 +65,17 @@
</div> </div>
<div class="flex flex-col md:ml-4 overflow-x-hidden overflow-y-visible"> <div class="flex flex-col md:ml-4 w-full overflow-x-hidden overflow-y-visible">
<h1 class="title">{{downloadEntry.title}}</h1> <h1 class="title">{{downloadEntry.title}}</h1>
<div class="relative my-4"> <div class="relative my-4">
<div v-if="downloadEntry.description != ''">
<p class="description p-2"> <p class="description p-2">
{{downloadEntry.description}} <span v-html="linebreaksToBrTags(downloadEntry.description)" />
</p> </p>
<div class="description__decobox description__decobox--left" /> <div class="description__decobox description__decobox--left" />
<div class="description__decobox description__decobox--right" /> <div class="description__decobox description__decobox--right" />
</div>
</div> </div>
</div> </div>
@ -87,6 +89,7 @@ import IconDownload from "~/components/Icons/download.vue";
import IconX from "~/components/Icons/x.vue"; import IconX from "~/components/Icons/x.vue";
import IconFilm from "~/components/Icons/film.vue"; import IconFilm from "~/components/Icons/film.vue";
import IconMusic from "~/components/Icons/music-note.vue"; import IconMusic from "~/components/Icons/music-note.vue";
import axios from "axios";
export default { export default {
components: { components: {
@ -109,10 +112,24 @@ export default {
}, },
getDurationString: function(unixTime) { getDurationString: function(unixTime) {
const time = new Date(unixTime * 1000); const time = new Date(unixTime * 1000);
const hours = ("0" + (time.getHours() - 1)).slice(-2); const hours = String((time.getHours() - 1));
const minutes = ("0" + (time.getMinutes())).slice(-2); const minutes = ("0" + (time.getMinutes())).slice(-2);
const seconds = ("0" + (time.getSeconds())).slice(-2); const seconds = ("0" + (time.getSeconds())).slice(-2);
return ((hours !== "0") ? hours : "") + ":" + minutes + ":" + seconds; return ((hours !== "0") ? (hours + ":") : "") + minutes + ":" + seconds;
},
linebreaksToBrTags: function(str) {
return str.replace("\n", '<br />');
},
removeDownload: function() {
const that = this;
axios.post("/api", {
request: "remove_download_entry",
id: this.downloadEntry.tubio_id
}).then(function(response) {
if (response.data.status === "OK") {
that.$store.dispatch("dlcache/update", that);
}
});
}, },
}, },
} }
@ -137,7 +154,6 @@ export default {
width: 150px; width: 150px;
height: calc(150px * (9 / 16)); height: calc(150px * (9 / 16));
position: relative; position: relative;
transition: transform 0.2s, background-image 1s ease-in-out;
cursor: pointer; cursor: pointer;
scrollbar-width: none; scrollbar-width: none;

View File

@ -1,13 +1,9 @@
<template> <template>
<div class="log-box"> <div class="log-box">
<LogEntry mode="normal" message="Hello, lol :3" /> <LogEntry v-for="(nObj, nKey) in logs"
<LogEntry mode="normal" message="Hello, lol :3" /> :mode="(nObj.type === 0) ? 'normal' : ((nObj.type === 1) ? 'warn' : 'error')"
<LogEntry mode="warn" message="Hello, lol :3" /> :message="nObj.compiledMessage"
<LogEntry mode="normal" message="Hello, lol :3" /> :key="nKey" />
<LogEntry mode="error" message="Hello, lol :3" />
<LogEntry mode="normal" message="Hello, lol :3" />
<LogEntry mode="normal" message="Hello, lol :3" />
<LogEntry mode="normal" message="Hello, lol :3" />
</div> </div>
</template> </template>
@ -17,6 +13,21 @@ import LogEntry from "~/components/LogEntry";
export default { export default {
components: { components: {
LogEntry, LogEntry,
},
computed: {
logs: function() {
return this.$store.state.logs.logs;
}
},
mounted() {
const that = this;
this.$store.dispatch("logs/update", this);
setInterval(function(){
that.$store.dispatch("logs/update", that);
}, 1000);
return;
} }
} }

View File

@ -3,7 +3,7 @@ export default {
target: 'static', target: 'static',
generate: { generate: {
dir: "web" dir: "../Tubio/frontend/"
}, },
server: { server: {

View File

@ -7,12 +7,22 @@
<Spacer height="2em" m_height="2em" /> <Spacer height="2em" m_height="2em" />
</div> </div>
<div class="flex flex-row input-flex justify-center"> <div class="flex flex-row flex-wrap md:flex-no-wrap input-flex justify-between md:justify-center">
<input class="flex-grow mr-4" type="url" name="" id="" placeholder="video-url"> <input class="flex-grow md:mr-4 mb-2 md:mb-0 w-full" type="url" name="video_url" id="video_url" ref="video_url" placeholder="video-url">
<div class="button flex-shrink button-submit flex-grow-0"> <div class="w-full md:hidden" />
<div class="flex-shrink button-submit flex-grow-0">
<select name="mode" id="mode" ref="mode" class="dropdown">
<option value="video">Video</option>
<option value="audio">Audio</option>
</select>
</div>
<div class="button flex-shrink button-submit flex-grow-0 ml-3" v-on:click="downloadButtonClicked">
<IconArrowRightSquare class="icon-button" /> <IconArrowRightSquare class="icon-button" />
</div> </div>
</div> </div>
<Spacer height="2em" m_height="2em" /> <Spacer height="2em" m_height="2em" />
@ -26,6 +36,7 @@ import Logo from "~/components/Logo";
import Spacer from "~/components/Spacer"; import Spacer from "~/components/Spacer";
import DownloadBox from "~/components/DownloadBox"; import DownloadBox from "~/components/DownloadBox";
import IconArrowRightSquare from "~/components/Icons/arrow-right-square"; import IconArrowRightSquare from "~/components/Icons/arrow-right-square";
import axios from "axios";
export default { export default {
components: { components: {
@ -33,6 +44,28 @@ export default {
Spacer, Spacer,
DownloadBox, DownloadBox,
IconArrowRightSquare, IconArrowRightSquare,
},
methods: {
downloadButtonClicked: function(){
const that = this;
if (this.$refs.video_url.value.match(/(https?:\/\/)?[a-zA-Z0-9-_.]+\.[a-zA-Z-_.]+/)) {
const url = this.$refs.video_url.value;
this.$refs.video_url.value = "";
axios.post("/api", {
request: "queue_download",
video_url: url,
mode: this.$refs.mode.options[this.$refs.mode.selectedIndex].value
}).then(function(response){
if (response.data.status === "OK") {
that.$store.dispatch("dlcache/update", that);
}
});
}
return;
}
} }
}; };
</script> </script>
@ -120,4 +153,13 @@ input {
} }
} }
.dropdown {
min-width: 100px;
height: 100%;
border-radius: 5px;
cursor: pointer;
font-family: ZillaSlab, serif;
font-size: 16pt;
}
</style> </style>

View File

@ -75,8 +75,8 @@
<Spacer height="50px"/> <Spacer height="50px"/>
<div class="button">Clear downloads</div> <div class="button" v-on:click="clearDLCache">Clear downloads</div>
<div class="button mt-2">Clear logs</div> <div class="button mt-2" v-on:click="clearLogs">Clear logs</div>
</div> </div>
@ -94,6 +94,7 @@
</template> </template>
<script> <script>
import axios from "axios";
import Toggle from "~/components/Toggle.vue"; import Toggle from "~/components/Toggle.vue";
import LogBox from "~/components/LogBox.vue"; import LogBox from "~/components/LogBox.vue";
import Spacer from "~/components/Spacer.vue"; import Spacer from "~/components/Spacer.vue";
@ -104,6 +105,35 @@ export default {
Toggle, Toggle,
LogBox, LogBox,
Spacer Spacer
},
methods: {
clearDLCache: function() {
const that = this;
axios.post("/api", {
request: "clear_download_cache",
}).then(function(response){
if (response.data.status === "OK") {
that.$store.dispatch("dlcache/update", that);
}
});
return;
},
clearLogs: function() {
const that = this;
axios.post("/api", {
request: "clear_logs",
}).then(function(response){
if (response.data.status === "OK") {
that.$store.dispatch("logs/update", that);
}
});
return;
},
} }
}; };
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
import axios from 'axios';
export const state = () => ({
cache: []
});
export const mutations = {
update(state, data) {
state.cache = data;
},
};
export const actions = {
update(context, instance) {
axios.post("/api", {
request: "fetch_alltime_cache"
})
.then(function(response) {
if (response.data.status === "OK") {
instance.$store.commit("dlcache/update", response.data.cache);
}
});
},
};

View File

@ -0,0 +1,24 @@
import axios from 'axios';
export const state = () => ({
logs: []
});
export const mutations = {
update(state, data) {
state.logs = data;
},
};
export const actions = {
update(context, instance) {
axios.post("/api", {
request: "fetch_session_logs"
})
.then(function(response) {
if (response.data.status === "OK") {
instance.$store.commit("logs/update", response.data.logs);
}
});
},
};