From: Jakob Haufe Date: Mon, 6 Aug 2012 20:31:37 +0000 (+0200) Subject: Imported Upstream version 1.3 X-Git-Tag: upstream/1.3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=608a65854915b5cf36ea7b6f92c412be27e22061;p=minitube Imported Upstream version 1.3 --- diff --git a/CHANGES b/CHANGES index eac32b8..ee7cef5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,8 +1,17 @@ +1.3 - Dec 10, 2010 +- Minitube works again! +- Big internal changes in how playback works, seeking is now disabled on Linux +- Brand new icon designed by David Nel +- Using Qt/Cocoa on the Mac, now requiring Leopard or better +- New Macedonian translation by Veta Branislav +- Updated Finnish translation +- New german translation by Jakob Kramer + 1.2 - Oct 11, 2010 - Ability to download videos - Support for media keys on GNOME - More style, especially on the Mac -- Fixed crash when trying delete or move the the las playlist item +- Fixed crash when trying delete or move the the last playlist item 1.1 - Jul 27, 2010 - Minitube now correctly plays cat and mouse with YouTube diff --git a/data/128x128/minitube.png b/data/128x128/minitube.png index d46188e..44f4add 100644 Binary files a/data/128x128/minitube.png and b/data/128x128/minitube.png differ diff --git a/data/16x16/minitube.png b/data/16x16/minitube.png index c785c2b..ab0d477 100644 Binary files a/data/16x16/minitube.png and b/data/16x16/minitube.png differ diff --git a/data/22x22/minitube.png b/data/22x22/minitube.png index bcb2a97..9e4df12 100644 Binary files a/data/22x22/minitube.png and b/data/22x22/minitube.png differ diff --git a/data/256x256/minitube.png b/data/256x256/minitube.png index 5a2a186..38c2c30 100644 Binary files a/data/256x256/minitube.png and b/data/256x256/minitube.png differ diff --git a/data/32x32/minitube.png b/data/32x32/minitube.png index 7d8d63a..27aed8b 100644 Binary files a/data/32x32/minitube.png and b/data/32x32/minitube.png differ diff --git a/data/48x48/minitube.png b/data/48x48/minitube.png index aeb6f11..398e2c3 100644 Binary files a/data/48x48/minitube.png and b/data/48x48/minitube.png differ diff --git a/data/512x512/minitube.png b/data/512x512/minitube.png index 1d1d0ed..77cfb03 100644 Binary files a/data/512x512/minitube.png and b/data/512x512/minitube.png differ diff --git a/data/64x64/minitube.png b/data/64x64/minitube.png index 674a03d..3afc57b 100644 Binary files a/data/64x64/minitube.png and b/data/64x64/minitube.png differ diff --git a/data/minitube.svg b/data/minitube.svg index 5d2670d..dfe72b1 100644 --- a/data/minitube.svg +++ b/data/minitube.svg @@ -1,5 +1,6 @@ + + width="256" + height="256" + id="svg5060" + version="1.1" + inkscape:version="0.48.0 r9654" + sodipodi:docname="minitube.svg"> - + id="defs5062"> + + + + + + + + id="linearGradient5368-5"> + id="stop5370-3" /> + id="stop5372-8" /> + inkscape:collect="always" + id="linearGradient4144-3"> + id="stop4146-4" /> + style="stop-color:#a64b1f;stop-opacity:1" + offset="1" + id="stop4148-2" /> + + + + id="stop4408-4" /> + id="linearGradient4440-0"> + id="stop4442-0" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="stop5288-5" /> + + + + + + + + inkscape:collect="always" + id="linearGradient4915-2-6"> + id="stop4917-5-9" /> + id="stop4919-4-3" /> + id="linearGradient4895-4"> + id="stop4897-7" /> + id="stop4899-0" /> + inkscape:collect="always" + id="linearGradient4887-3"> + + + + + + + + + + + + + id="stop4818-3" /> + id="stop4820-8" /> + id="linearGradient3960-2"> + id="stop3962-9" /> + id="stop3964-6" /> + inkscape:collect="always" + id="linearGradient3975-4"> + id="stop3977-5" /> + id="stop3979-5" /> + id="linearGradient4371-6"> + id="stop4373-2" /> + id="stop4375-6" /> + + + + + + + + + + + id="filter4630-0" + x="-0.12742878" + width="1.2548577" + y="-0.48608795" + height="1.972176" + color-interpolation-filters="sRGB"> + + + + + + + + + + + + + + + + + + + + + + + + + + + id="stop4462-3" /> + id="stop4464-3" /> + + + + + gradientTransform="matrix(3.8921716,0,0,3.8921716,323.44145,-110.87361)" + x1="109.48217" + y1="28.91128" + x2="108.68206" + y2="34.568138" /> + + + + + gradientTransform="matrix(4.8594622,-0.11058189,0.05843403,2.5678511,213.72352,-2423.9327)" + cx="60.413155" + cy="945.41626" + fx="60.413155" + fy="945.41626" + r="64" /> + + + + + gradientTransform="matrix(3.8921716,0,0,0.37761572,327.44145,65.748855)" + cx="59.75" + cy="-1043.5648" + fx="59.75" + fy="-1043.5648" + r="59.5" /> + gradientTransform="matrix(3.8921716,0,0,-3.8921716,327.44145,-3708.6498)" /> + + + + + + + + + + + + + + cx="111.25" + cy="71.5" + fx="111.25" + fy="71.5" + r="7.75" /> + x1="109.48217" + y1="28.91128" + x2="108.68206" + y2="34.568138" + gradientTransform="matrix(3.8921716,0,0,3.8921716,323.44145,-35.532655)" /> + + + + + + gradientTransform="matrix(3.8921716,0,0,-3.883747,327.44145,389.16593)" + cx="10.1875" + cy="30.633202" + fx="10.1875" + fy="30.633202" + r="14.4375" /> + + + + + + + gradientTransform="translate(323.39805,233.35946)" + x1="203.16451" + y1="-258.83478" + x2="210.00467" + y2="59.165237" /> + gradientTransform="matrix(3.8921716,0,0,3.8921716,327.44145,-110.87361)" /> + gradientTransform="translate(0,7.5)" /> + + + inkscape:window-y="0" + inkscape:window-maximized="0" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0"> + id="grid3243" + empspacing="5" + visible="true" + enabled="true" + snapvisiblegridlinesonly="true" /> + id="metadata5065"> image/svg+xml + + id="layer1" + transform="translate(-211.91083,-239.45013)"> - - - + style="display:inline" + id="g4909" + transform="matrix(0.47216003,0,0,0.47920117,67.002335,300.84116)" + inkscape:export-filename="/home/kolorguild/Desktop/MiniTube_Rev1.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - diff --git a/images/app.png b/images/app.png index 18961b3..44f4add 100644 Binary files a/images/app.png and b/images/app.png differ diff --git a/locale/de_DE.ts b/locale/de_DE.ts index d491dd7..b69915b 100644 --- a/locale/de_DE.ts +++ b/locale/de_DE.ts @@ -7,47 +7,59 @@ There's life outside the browser! - Es gibt Leben außerhalb des Browsers! + Es existiert Leben neben dem Browser! Version %1 Version %1 + + This is a "Technology Preview" release, do not expect it to be perfect. + Dies ist eine "Technology Vorschau", erwarte nicht, dass sie perfekt ist. + Report bugs and send in your ideas to %1 - Berichten Sie Fehler und senden Sie Ihre Ideen an %1 + Bitte berichte Fehler und sende Deine Ideen an %1 %1 is Free Software but its development takes precious time. %1 ist freie Software, aber die Entwicklung kostet wertvolle Zeit. + + Please <a href='%1'>donate via PayPal</a> to support the continued development of %2. + Bitte <a href='%1'>spende via PayPal</a> um die dauerhafte Entwicklung von %2 zu unterstützen. + Please <a href='%1'>donate</a> to support the continued development of %2. - Bitte <a href='%1'>spenden</a> Sie um die ständige Entwicklung von %2 zu unterstützen. + Bitte <a href='%1'>spende</a>, um die ständige Entwicklung von %2 zu unterstützen. Icon designed by %1. - Icon entworfen von %1. + Symbol-Entwurf durch %1. Compact mode contributed by %1. - Kompakt-Ansicht beigetragen von %1. + Kompakt-Modus beigetragen von %1. HTTP proxy support contributed by %1. - HTTP-Proxy Unterstützung beigetragen von %1. + HTTP Proxy-Unterstützung beigetragen von %1. + + + Windows version built by %1 + Windows Version erstellt durch %1 Translated by %1 - Übersetzt von %1 + Übersetzung durch %1 @@ -67,7 +79,7 @@ What you always wanted to know about %1 and never dared to ask - Was Sie schon immer über %1 wissen wollten, aber nie zu fragen wagten + Was Du schon immer über %1 wissen wolltest, aber nie zu fragen wagtest @@ -75,7 +87,7 @@ Clear - Löschen + Säubern @@ -85,30 +97,30 @@ bytes Bytes - - - bytes/sec - Bytes/s - - KiB - KiB + KB + kB - MiB - MiB + MB + MB + + + + bytes/sec + Bytes/s - KiB/sec - KiB/s + KB/sec + kB/s - MiB/sec - MiB/s + MB/sec + MB/s @@ -131,12 +143,12 @@ This is just the demo version of %1. - Dies ist nur eine Demoversion von %1. + Dies ist nur die Demoversion von %1. It can only download videos shorter than %1 minutes so you can test the download functionality. - Sie kann nur Videos herunterladen, die kürzer als %1 Minuten sind, damit Sie diese Funktion testen können. + Sie kann nur Videos die kürzer als %1 Minuten sind herunterladen, damit die Download-Funktionalität getestet werden kann. @@ -146,7 +158,7 @@ Get the full version - Volle Version herunterladen + Die Vollversion holen @@ -162,27 +174,27 @@ Change location... - Pfad ändern... + Speicherort ändern… Choose the download location - Download-Verzeichnis auswählen + Wähle den Speicherort Download location changed. - Download-Verzeichnis geändert. + Speicherort wurde verändert. Current downloads will still go in the previous location. - Bereits laufende Downloads bleiben weiterhin im alten Verzeichnis. + Aktuelle Downloads werden immernoch im alten Speicherort gespeichert. Downloading to: %1 - Speichere in: %1 + Lade herunter nach: %1 @@ -204,22 +216,22 @@ Pause - Pausieren + Pause Play/Pause - Wiedergeben/Pausieren + Abspielen/Pause Stop - Anhalten + Halt Stop playing after current track - Wiedergabe nach aktuellem Titel anhalten + Nachdem aktueller Titel abgespielt wurde halten @@ -244,17 +256,17 @@ Mute - Stumm schalten + Stummschalten Seek forward - Vorspulen + Vorwärts spulen Seek backward - Zurückspulen + Rückwärts spulen @@ -290,15 +302,23 @@ MainWindow + + &Back + &Zurück + + + Go to the previous view + Gehe zur vorherigen Ansicht + &Stop - An&alten + &Halt Stop playback and go back to the search view - Wiedergabe anhalten und zurück zur Suchansicht + Wiedergabe anhalten und zur Suchansicht zurückkehren @@ -308,7 +328,7 @@ Skip to the next video - Springe zum nächsten Video + Zum nächsten Video springen @@ -333,6 +353,26 @@ Go full screen Vollbildmodus aktivieren + + &Compact View + &Kompakt Ansicht + + + Go compact view + Kompakt Ansicht aktivieren + + + &YouTube + &YouTube + + + Open the YouTube video page + Öffne die YouTube Video Seite + + + Ctrl+Y + Ctrl+Y + &Compact mode @@ -346,37 +386,45 @@ &Download - &Herunterladen + H&erunterladen + + + Download this video + Dieses Video herunterladen + + + Ctrl+S + Strg+S Open the &YouTube page - Öffne die &YouTube Seite + Öffne die &YouTube-Seite Go to the YouTube video page and pause playback - Gehe zur YouTube Video Seite und pausiere die Wiedergabe + Gehe zur YouTube-Video-Seite und pausiere die Wiedergabe Copy the YouTube &link - YouTube &Link kopieren + YouTube-&Link kopieren Copy the current video YouTube link to the clipboard - YouTube Link in die Zwischenablage kopieren + YouTube-Link in die Zwischenablage kopieren Copy the video stream &URL - Video &URL kopieren + Video-&URL kopieren Copy the current video stream URL to the clipboard - Video URL in die Zwischenablage kopieren + Video-URL in die Zwischenablage kopieren @@ -396,7 +444,7 @@ Move up the selected videos in the playlist - Bewerge das ausgewählte Video in der Abspielliste hinauf + Bewege das ausgewählte Video in der Abspielliste hinauf @@ -416,7 +464,7 @@ Clear the search history. Cannot be undone. - Such-Chronik löschen. Kann nicht rückgängig gemacht werden. + Such-Verlauf leeren. Kann nicht rückgängig gemacht werden. @@ -426,7 +474,7 @@ Ctrl+Q - Ctrl+Q + Strg+Q @@ -441,12 +489,12 @@ %1 on the Web - %1 im Internet + %1 im Web Make a &donation - Eine Spen&de machen + Spen&den @@ -457,47 +505,51 @@ Show details about video downloads - Details über Video-Downloads zeigen + Zeige Details über Video-Downloads Download the current video - Video herunterladen + Das aktuelle Video herunterladen Do you want to exit %1 with a download in progress? - Wollen Sie %1 mit einem aktivem Download beenden? + Möchtest Du %1 mit einem aktiven Download beenden? If you close %1 now, this download will be cancelled. - Wenn Sie %1 beenden, wird das Herunterladen abgebrochen. + Wenn Du %1 jetzt beendest, wird der Download abgebrochen. Close and cancel download - Beenden und Herunterladen abbrechen + Beenden und Download abbrechen Wait for download to finish - Warten, bis das Herunterladen abgeschlossen ist + Auf Abschluß des Downloads warten Maximum video definition set to %1 - Maximale Videoauflösung wurde auf %1 gesetzt + Maximale Video-Auflösung wurde auf %1 gesetzt Downloads complete - Downloads abgeschlossen + Downloads heruntergeladen + + + &Donate via PayPal + Spen&den via PayPal Please support the continued development of %1 - Bitte unterstützen Sie die fortwährende Entwicklung von %1 + Bitte unterstütze die weitere Entwicklung von %1 @@ -517,7 +569,7 @@ Mute volume - Ton stumm schalten + Stummschalten @@ -534,10 +586,58 @@ Remaining time: %1 Verbleibende Zeit: %1 + + High Definition video is enabled + High Definition Video ist eingeschaltet + + + High Definition video is not enabled + High Definition Video ist nicht eingeschaltet + + + The current video is in High Definition + Das derzeitige Video ist in High Definition + + + The current video is not in High Definition + Das derzeitige Video ist nicht in High Definition + Your privacy is now safe - Ihre Privatsphäre ist nun geschützt + Deine Privatsphäre ist nun geschützt + + + No Video playing + Es wird kein Video abgespielt + + + You must first play the video you intent to download ! + Du musst das Video erst abspielen ! + + + Save video as... + Video speichern unter... + + + minitube video.mp4 + minitube video.mp4 + + + Downloading: + Herunterladen: + + + Abort Download + Herunterladen abbrechen + + + File creation failed + Das anlegen der Datei ist fehlgeschlagen + + + Download failed + Herunterladen fehlgeschlagen @@ -547,12 +647,16 @@ Volume is muted - Ton ist stumm geschaltet + Ton ist stummgeschaltet Volume is unmuted - Stummschaltung deaktiviert + Ton ist angeschaltet + + + &Search + &Suche @@ -562,7 +666,7 @@ &Playlist - &Abspielliste + A&bspielliste @@ -611,12 +715,12 @@ Most relevant - Die bedeutsamsten + Die Bedeutsamsten Most recent - Die neusten + Die Neusten @@ -626,12 +730,12 @@ You can now paste the YouTube link into another application - Sie können nun den YouTube Link in einer anderen Anwendung einfügen + Du kannst den YouTube-Link nun in einer anderen Anwendung einfügen You can now paste the video stream URL into another application - Sie können nun die Video URL in einer anderen Anwendung einfügen + Du kannst die Video-URL nun in einer anderen Anwendung einfügen @@ -646,7 +750,7 @@ It allows you to test the application and see if it works for you. - Es gibt Ihnen die Möglichkeit das Programm zu testen und zu sehen, ob es funktioniert. + Sie erlaubt Dir die Anwendung zu testen und zu schauen ob es bei Dir läuft. @@ -656,7 +760,7 @@ Get the full version - Volle Version herunterladen + Die Vollversion holen @@ -666,7 +770,7 @@ You're watching "%1" - Sie betrachten "%1" + Du betrachtest "%1" @@ -687,12 +791,12 @@ %1 of %2 (%3) ? %4 - %1 von %2 (%3) ? %4 + %1 von %2 (%3) – %4 Preparing - Initialisiere + Bereite vor @@ -702,27 +806,27 @@ Completed - Abgeschlossen + Fertiggestellt Stopped - Abgebrochen + Gestoppt Stop downloading - Herunterladen abbrechen + Stoppe herunterladen Show in %1 - + Zeige in %1 Open parent folder - Beinhaltenden Ordner öffnen + Eltern-Ordner öffnen @@ -758,7 +862,7 @@ Recent keywords - Kürzlich verwendete Schlüsselwörter + Aktuelle Schlüsselwörter @@ -768,7 +872,18 @@ Make yourself comfortable - Machen Sie es sich gemütlich + Mach es Dir gemütlich + + + + SettingsView + + Preferences + Einstellungen + + + &Close + S&chließen @@ -776,7 +891,7 @@ Network error: %1 for %2 - Netzwerk Fehler: %1 für %2 + Netzwerk-Fehler: %1 für %2 diff --git a/locale/fi_FI.ts b/locale/fi_FI.ts index 061d14d..dde17fe 100644 --- a/locale/fi_FI.ts +++ b/locale/fi_FI.ts @@ -68,146 +68,146 @@ DownloadItem bytes - + tavua KB - + Kt MB - + Mt bytes/sec - + tavua/sekunnissa KB/sec - + Kt/s MB/sec - + Mt/s seconds - + sekunttia minutes - + minuuttia %4 %5 remaining - + %4 %5 jäljellä DownloadManager %n Download(s) - - + + %n Lataus(ta) This is just the demo version of %1. - + Tämä on vain kokeilu versio %1sta. It can only download videos shorter than %1 minutes so you can test the download functionality. - + Voit ladata vain videoita jotka ovat lyhyempiä kuin %1 minuuttia, jotta voit testata lataus ominaisuutta. Continue - + Jatka Get the full version - + Hanki täysi versio DownloadSettings Change location... - + Vaihda sijaintia... Choose the download location - + Valitse latausten sijainti Download location changed. - + Lataus sijaintia on muutettu. Current downloads will still go in the previous location. - + Nykyiset lataukset menevät vanhaan sijaintiin. Downloading to: %1 - + Ladataan kansioon: %1 DownloadView Downloads - + Lataukset GlobalShortcuts Play - + Toista Pause - + Keskeytä Play/Pause - + Toista/Keskeytä Stop - + Pysäytä Stop playing after current track - + Pysäytä toisto nykyisen kappaleen jälkeen Next track - + Seuraava kappale Previous track - + Edellinen kappale Increase volume - + Lisää äänen voimakkuutta Decrease volume - + Vähennä äänen voimakkuutta Mute - + Mykistä Seek forward - + Kelaa eteenpäin Seek backward - + Kelaa taaksepäin @@ -452,39 +452,39 @@ &Downloads - + &Lataukset Show details about video downloads - + Näytä tietoja latauksista &Download - + &Lataa Download the current video - + Lataa nykyinen video Do you want to exit %1 with a download in progress? - + Tahdotko lopettaa vaikka %1 lataus(ta) on kesken? If you close %1 now, this download will be cancelled. - + Jos suljet %1n nyt niin tämä lataus keskeytetään. Close and cancel download - + Sulje ja keskeytä lataus Wait for download to finish - + Odota latauksen valmistumista Downloads complete - + Lataukset ovat valmistuneet @@ -519,23 +519,23 @@ This is just the demo version of %1. - + Tämä on vain %1n kokeiluversio. It allows you to test the application and see if it works for you. - + Voit kokeilla ohjelmaa nähdäksesi että toimiiko se. Continue - + Jatka Get the full version - + Hanki täysi versio Downloading %1 - + Ladataan %1ta/tä @@ -553,39 +553,39 @@ %1 of %2 (%3) ? %4 - + %1 %2 (%3)sta ? %4 Preparing - + Valmistellaan Failed - + Epäonnistui Completed - + Valmis Stopped - + Pysäytetty Stop downloading - + Pysäytä lataus Show in %1 - + Avaa %1ssa/ssä Open parent folder - + Avaa yläkansio Restart downloading - + Käynnistä lataus uudelleen diff --git a/locale/locale.pri b/locale/locale.pri index 77a2f13..e3d47fa 100644 --- a/locale/locale.pri +++ b/locale/locale.pri @@ -29,7 +29,8 @@ TRANSLATIONS += \ pt_PT.ts \ fi_FI.ts \ bg_BG.ts \ - zh_CN.ts + zh_CN.ts \ + mkd_MKD.ts isEmpty(QMAKE_LRELEASE) { win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\lrelease.exe diff --git a/locale/mkd_MKD.ts b/locale/mkd_MKD.ts new file mode 100644 index 0000000..09a8099 --- /dev/null +++ b/locale/mkd_MKD.ts @@ -0,0 +1,447 @@ + + + + + + + There's life outside the browser! + AboutView + Има живот и надвор од браузерот! + + + Version %1 + AboutView + Верзија %1 + + + %1 is Free Software but its development takes precious time. + AboutView + %1 е Слободен Софтвер, но неговиот развој одзема драгоцено време. + + + Please <a href='%1'>donate</a> to support the continued development of %2. + AboutView + Ве молам <a href='%1'>донирајте</a> за да го поддржите понатамошниот развој на %2. + + + Report bugs and send in your ideas to %1 + AboutView + Известувајте за грешки и испраќајте ги вашите идеи на %1 + + + Icon designed by %1. + AboutView + Иконите се изработени од %1. + + + Compact mode contributed by %1. + AboutView + Компактниот режим е објавен од %1. + + + HTTP proxy support contributed by %1. + AboutView + HTTP proxy поддржката е објавена од %1. + + + Translated by %1 + AboutView + Преведено од %1 + + + Released under the <a href='%1'>GNU General Public License</a> + AboutView + Објавено е под <a href='%1'>GNU General Public License</a> + + + &Close + AboutView + &Затвори + + + About + AboutView + За + + + What you always wanted to know about %1 and never dared to ask + AboutView + Што одсекогаш сте сакале да знаете за %1 но никогаш не сте се осмелиле да прашате + + + Clear + ClearButton + Исчисти + + + Searching... + ListModel + Пребарување... + + + Show %1 More + ListModel + Прикажи %1 повеќе + + + No videos + ListModel + Нема видео + + + No more videos + ListModel + Нема повеќе видеа + + + Error + LoadingWidget + Грешка + + + &Stop + MainWindow + &Стоп + + + Stop playback and go back to the search view + MainWindow + Стопирај ја репродукцијата и врати се во пребарувачот + + + S&kip + MainWindow + П&рескокни + + + Skip to the next video + MainWindow + Следно видео + + + &Pause + MainWindow + &Пауза + + + Pause playback + MainWindow + Паузирај ја репродукцијата + + + &Full Screen + MainWindow + &Цел Екран + + + Go full screen + MainWindow + Отвори на цел екран + + + &Compact mode + MainWindow + &Компактен режим + + + Hide the playlist and the toolbar + MainWindow + Сокриј ја плејлистата и лентата со алатки + + + Open the &YouTube page + MainWindow + Отвори ја &YouTube страницата + + + Go to the YouTube video page and pause playback + MainWindow + Отиди на YouTube страницата и паузирај ја репродукцијата + + + Copy the YouTube &link + MainWindow + Копирај го YouTube &линкот + + + Copy the current video YouTube link to the clipboard + MainWindow + Копирај го видео линот од YouTube во клипбодот + + + Copy the video stream &URL + MainWindow + Копирај го &URL-то на видео емитувањето + + + Copy the current video stream URL to the clipboard + MainWindow + Копирај го URL-то на гледаното видео во клипбордот + + + &Remove + MainWindow + &Отстрани + + + Remove the selected videos from the playlist + MainWindow + Отстранете ги избраните видеа од плејлистата + + + Move &Up + MainWindow + Придвижи &нагоре + + + Move up the selected videos in the playlist + MainWindow + Премести ги избраните видеа во плејлистата + + + Move &Down + MainWindow + Придвижи &надолу + + + Move down the selected videos in the playlist + MainWindow + Премести ги надолу во плејлистата избраните видеа + + + &Clear recent keywords + MainWindow + &Исчисти ги последниве клучни зборови + + + Clear the search history. Cannot be undone. + MainWindow + Исчисти ја историјата од пребарувањето.Неможе да се назад. + + + &Quit + MainWindow + &Излез + + + Ctrl+Q + MainWindow + Ctrl+Q + + + Bye + MainWindow + Чао + + + &Website + MainWindow + &Веб страна + + + %1 on the Web + MainWindow + %1 на Веб + + + Make a &donation + MainWindow + Направи &донација + + + Please support the continued development of %1 + MainWindow + Ве молам подпомогнете го идниот развој на %1 + + + &About + MainWindow + &За + + + Info about %1 + MainWindow + Информација за %1 + + + Search + MainWindow + Пребарување + + + Mute volume + MainWindow + Прекини го звукот + + + Ctrl+M + MainWindow + Ctrl+M + + + &Application + MainWindow + &Апликација + + + &Playlist + MainWindow + &Плејлиста + + + &Video + MainWindow + &Видео + + + &Help + MainWindow + &Помош + + + Press %1 to raise the volume, %2 to lower it + MainWindow + Притисни %1 за да го зголемиш звукот, %2 да го намалиш + + + Opening %1 + MainWindow + Се отвара %1 + + + Fatal error: %1 + MainWindow + Фатална грешка: %1 + + + Error: %1 + MainWindow + Грешка: %1 + + + &Play + MainWindow + &Пушти + + + Resume playback + MainWindow + Продолжи со репродукција + + + Exit &Full Screen + MainWindow + Излези од &Цел екран + + + Remaining time: %1 + MainWindow + Останато време: %1 + + + Volume at %1% + MainWindow + Звук на %1% + + + Volume is muted + MainWindow + Звукот е исклучен + + + Volume is unmuted + MainWindow + Звукот е вклучен + + + Maximum video definition set to %1 + MainWindow + Максималната видео резолуција е поставена на %1 + + + Your privacy is now safe + MainWindow + Вашата приватност е заштитена + + + Most relevant + MediaView + Најрелевантни + + + Most recent + MediaView + Најновите + + + Most viewed + MediaView + Најмногу гледани + + + You can now paste the YouTube link into another application + MediaView + Може да го вметнете YouTube линкот во друга апликација + + + You can now paste the video stream URL into another application + MediaView + Може да ја вметнете URL адресата на емитувањето во друга апликација + + + The link will be valid only for a limited time. + MediaView + Линкот ќе биде валиден само за определно време. + + + You're watching "%1" + MediaView + Вие гледате "%1" + + + Network error: %1 + NetworkAccess + Грешка во мрежата: %1 + + + %1 views + PrettyItemDelegate + %1 прегледувања + + + Welcome to <a href='%1'>%2</a>, + SearchView + Добредојдовте во <a href='%1'>%2</a>, + + + Enter a keyword to start watching videos. + SearchView + Внесете клучен збор за да почнете да гледате видео клипови. + + + Watch + SearchView + Гледај + + + Recent keywords + SearchView + Последни користени клучни зборови + + + A new version of %1 is available. Please <a href='%2'>update to version %3</a> + SearchView + Нова верзија на %1 е достапна.Ве молиме <a href='%2'> обновете до верзија %3</a> + + + Make yourself comfortable + SearchView + Опуштете се + + + Network error: %1 for %2 + Video + Грешка во мрежата: %1 за %2 + + + diff --git a/minitube.pro b/minitube.pro index bea0df2..94ac55e 100755 --- a/minitube.pro +++ b/minitube.pro @@ -1,6 +1,6 @@ CONFIG += release TEMPLATE = app -VERSION = 1.2 +VERSION = 1.3 DEFINES += APP_VERSION="$$VERSION" INCLUDEPATH += /usr/include/phonon diff --git a/src/AboutView.cpp b/src/AboutView.cpp index 961c867..1a0ec17 100644 --- a/src/AboutView.cpp +++ b/src/AboutView.cpp @@ -59,7 +59,8 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) { "Daniel Rodrigues (pt_PT), " "Jesse Jaara (fi_FI), " "Tsvyatko Makazchiev (bg_BG), " - "Changtai Liang (zh_CN)" + "Changtai Liang (zh_CN), " + "Veta Branislav (mkd_MKD)" ) + "

" #if !defined(APP_MAC) && !defined(Q_WS_WIN) "

" + tr("Released under the GNU General Public License") diff --git a/src/ListModel.cpp b/src/ListModel.cpp index 761e5a4..1c146ee 100755 --- a/src/ListModel.cpp +++ b/src/ListModel.cpp @@ -202,6 +202,10 @@ void ListModel::addVideo(Video* video) { // save keyword QString query = searchParams->keywords(); + if (query.startsWith("http://")) { + // Save the video title + query += "|" + videos.first()->title(); + } QSettings settings; QStringList keywords = settings.value(recentKeywordsKey).toStringList(); keywords.removeAll(query); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index c87c398..1ef752b 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -45,6 +45,7 @@ MainWindow::MainWindow() : createStatusBar(); initPhonon(); + // mediaView->setSlider(slider); mediaView->setMediaObject(mediaObject); // remove that useless menu/toolbar context menu @@ -395,12 +396,24 @@ void MainWindow::createToolBars() { mainToolBar->addWidget(new Spacer()); seekSlider = new Phonon::SeekSlider(this); +#ifdef Q_WS_X11 + seekSlider->setDisabled(true); +#endif seekSlider->setIconVisible(false); seekSlider->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); mainToolBar->addWidget(seekSlider); mainToolBar->addWidget(new Spacer()); +/* + slider = new QSlider(this); + slider->setOrientation(Qt::Horizontal); + slider->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + mainToolBar->addWidget(slider); +*/ + + mainToolBar->addWidget(new Spacer()); + totalTime = new QLabel(mainToolBar); totalTime->setFont(smallerFont); mainToolBar->addWidget(totalTime); @@ -453,7 +466,7 @@ void MainWindow::readSettings() { restoreGeometry(settings.value("geometry").toByteArray()); #ifdef APP_MAC if (!isMaximized()) - move(x(), y() + mainToolBar->height() + 8); + move(x(), y() + 10); #endif setDefinitionMode(settings.value("definition", VideoDefinition::getDefinitionNames().first()).toString()); audioOutput->setVolume(settings.value("volume", 1).toDouble()); @@ -814,6 +827,11 @@ void MainWindow::tick(qint64 time) { const qint64 remainingTime = mediaObject->remainingTime(); currentTime->setStatusTip(tr("Remaining time: %1").arg(formatTime(remainingTime))); + /* + slider->blockSignals(true); + slider->setValue(time/1000); + slider->blockSignals(false); + */ } void MainWindow::totalTimeChanged(qint64 time) { @@ -822,6 +840,13 @@ void MainWindow::totalTimeChanged(qint64 time) { return; } totalTime->setText(formatTime(time)); + + /* + slider->blockSignals(true); + slider->setMaximum(time/1000); + slider->blockSignals(false); + */ + } QString MainWindow::formatTime(qint64 time) { diff --git a/src/MainWindow.h b/src/MainWindow.h index e90dbf8..203a214 100755 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -21,6 +21,7 @@ class MainWindow : public QMainWindow { public: MainWindow(); ~MainWindow(); + Phonon::SeekSlider* getSeekSlider() { return seekSlider; } protected: void closeEvent(QCloseEvent *); @@ -125,6 +126,7 @@ private: // phonon Phonon::SeekSlider *seekSlider; + // QSlider *slider; Phonon::VolumeSlider *volumeSlider; Phonon::MediaObject *mediaObject; Phonon::AudioOutput *audioOutput; diff --git a/src/MediaView.cpp b/src/MediaView.cpp index 739c595..8890ace 100644 --- a/src/MediaView.cpp +++ b/src/MediaView.cpp @@ -5,6 +5,12 @@ #include "minisplitter.h" #include "constants.h" #include "downloadmanager.h" +#include "downloaditem.h" +#include "MainWindow.h" + +namespace The { + NetworkAccess* http(); +} namespace The { QMap* globalActions(); @@ -15,6 +21,7 @@ namespace The { MediaView::MediaView(QWidget *parent) : QWidget(parent) { reallyStopped = false; + downloadItem = 0; QBoxLayout *layout = new QHBoxLayout(); layout->setMargin(0); @@ -152,6 +159,12 @@ void MediaView::search(SearchParams *searchParams) { workaroundTimer->stop(); errorTimer->stop(); + mediaObject->pause(); + if (downloadItem) { + delete downloadItem; + downloadItem = 0; + } + this->searchParams = searchParams; // start serching for videos @@ -162,6 +175,17 @@ void MediaView::search(SearchParams *searchParams) { listView->setFocus(); + + QString keyword = searchParams->keywords(); + QString display = keyword; + if (keyword.startsWith("http://")) { + int separator = keyword.indexOf("|"); + if (separator > 0 && separator + 1 < keyword.length()) { + display = keyword.mid(separator+1); + } + } + // tr("You're watching \"%1\"").arg(searchParams->keywords()) + } void MediaView::disappear() { @@ -179,12 +203,14 @@ void MediaView::stateChanged(Phonon::State newState, Phonon::State /*oldState*/) { // qDebug() << "Phonon state: " << newState << oldState; + // slider->setEnabled(newState == Phonon::PlayingState); switch (newState) { case Phonon::ErrorState: qDebug() << "Phonon error:" << mediaObject->errorString() << mediaObject->errorType(); - handleError(mediaObject->errorString()); + if (mediaObject->errorType() == Phonon::FatalError) + handleError(mediaObject->errorString()); break; case Phonon::PlayingState: @@ -244,6 +270,10 @@ void MediaView::stop() { workaroundTimer->stop(); errorTimer->stop(); listView->selectionModel()->clearSelection(); + if (downloadItem) { + delete downloadItem; + downloadItem = 0; + } } void MediaView::activeRowChanged(int row) { @@ -257,6 +287,13 @@ void MediaView::activeRowChanged(int row) { workaroundTimer->stop(); errorTimer->stop(); + mediaObject->pause(); + if (downloadItem) { + delete downloadItem; + downloadItem = 0; + } + // slider->setMinimum(0); + // immediately show the loading widget videoAreaWidget->showLoading(video); @@ -289,9 +326,75 @@ void MediaView::gotStreamUrl(QUrl streamUrl) { } video->disconnect(this); + QString tempDir = QDesktopServices::storageLocation(QDesktopServices::TempLocation); + QString tempFile = tempDir + "/minitube.mp4"; + if (!QFile::remove(tempFile)) { + qDebug() << "Cannot remove temp file"; + } + + Video *videoCopy = video->clone(); + if (downloadItem) delete downloadItem; + downloadItem = new DownloadItem(videoCopy, streamUrl, tempFile, this); + connect(downloadItem, SIGNAL(statusChanged()), SLOT(downloadStatusChanged())); + // connect(downloadItem, SIGNAL(progress(int)), SLOT(downloadProgress(int))); + // connect(downloadItem, SIGNAL(finished()), SLOT(itemFinished())); + downloadItem->start(); + +} + +/* +void MediaView::downloadProgress(int percent) { + MainWindow* mainWindow = dynamic_cast(window()); + + mainWindow->getSeekSlider()->setStyleSheet(" QSlider::groove:horizontal {" + "border: 1px solid #999999;" + // "border-left: 50px solid rgba(255, 0, 0, 128);" + "height: 8px;" + "background: qlineargradient(x1:0, y1:0, x2:.5, y2:0, stop:0 rgba(255, 0, 0, 92), stop:" + + QString::number(percent/100.0) + + + " rgba(255, 0, 0, 92), stop:" + QString::number((percent+1)/100.0) + " transparent, stop:1 transparent);" + "margin: 2px 0;" + "}" + "QSlider::handle:horizontal {" + "background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);" + "border: 1px solid #5c5c5c;" + "width: 16px;" + "height: 16px;" + "margin: -2px 0;" + "border-radius: 8px;" + "}" + + ); +} + +*/ + +void MediaView::downloadStatusChanged() { + switch(downloadItem->status()) { + case Downloading: + startPlaying(); + break; + case Starting: + qDebug() << "Starting"; + break; + case Finished: + qDebug() << "Finished"; + break; + case Failed: + qDebug() << "Failed"; + case Idle: + qDebug() << "Idle"; + break; + } +} + +void MediaView::startPlaying() { + if (reallyStopped) return; + // go! - qDebug() << "Playing" << streamUrl.toString(); - mediaObject->setCurrentSource(streamUrl); + qDebug() << "Playing" << downloadItem->currentFilename(); + mediaObject->setCurrentSource(downloadItem->currentFilename()); mediaObject->play(); // ensure we always have 10 videos ahead @@ -364,7 +467,7 @@ void MediaView::copyWebPage() { void MediaView::copyVideoLink() { Video* video = listModel->activeVideo(); if (!video) return; - QApplication::clipboard()->setText(video->getStreamUrl().toString()); + QApplication::clipboard()->setText(video->getStreamUrl().toEncoded()); QString message = tr("You can now paste the video stream URL into another application") + ". " + tr("The link will be valid only for a limited time."); QMainWindow* mainWindow = dynamic_cast(window()); @@ -500,3 +603,50 @@ void MediaView::fullscreen() { videoAreaWidget->setParent(0); videoAreaWidget->showFullScreen(); } + +/* +void MediaView::setSlider(QSlider *slider) { + this->slider = slider; + // slider->setEnabled(false); + slider->setTracking(false); + // connect(slider, SIGNAL(valueChanged(int)), SLOT(sliderMoved(int))); +} + +void MediaView::sliderMoved(int value) { + qDebug() << __func__; + int sliderPercent = (value * 100) / (slider->maximum() - slider->minimum()); + qDebug() << slider->minimum() << value << slider->maximum(); + if (sliderPercent <= downloadItem->currentPercent()) { + qDebug() << sliderPercent << downloadItem->currentPercent(); + mediaObject->seek(value); + } else { + seekTo(value); + } +} + +void MediaView::seekTo(int value) { + qDebug() << __func__; + mediaObject->pause(); + workaroundTimer->stop(); + errorTimer->stop(); + // mediaObject->clear(); + + QString tempDir = QDesktopServices::storageLocation(QDesktopServices::TempLocation); + QString tempFile = tempDir + "/minitube" + QString::number(value) + ".mp4"; + if (!QFile::remove(tempFile)) { + qDebug() << "Cannot remove temp file"; + } + Video *videoCopy = downloadItem->getVideo()->clone(); + QUrl streamUrl = videoCopy->getStreamUrl(); + streamUrl.addQueryItem("begin", QString::number(value)); + if (downloadItem) delete downloadItem; + downloadItem = new DownloadItem(videoCopy, streamUrl, tempFile, this); + connect(downloadItem, SIGNAL(statusChanged()), SLOT(downloadStatusChanged())); + // connect(downloadItem, SIGNAL(finished()), SLOT(itemFinished())); + downloadItem->start(); + + // slider->setMinimum(value); + +} + +*/ diff --git a/src/MediaView.h b/src/MediaView.h index 7a19d68..f61799a 100644 --- a/src/MediaView.h +++ b/src/MediaView.h @@ -13,6 +13,8 @@ #include "loadingwidget.h" #include "videoareawidget.h" +class DownloadItem; + namespace The { QMap* globalActions(); } @@ -32,13 +34,14 @@ public: QMap metadata() { QMap metadata; if (searchParams) { - metadata.insert("title", searchParams->keywords()); - metadata.insert("description", tr("You're watching \"%1\"").arg(searchParams->keywords())); + metadata.insert("title", ""); + metadata.insert("description", ""); } return metadata; } void setMediaObject(Phonon::MediaObject *mediaObject); + void setSlider(QSlider *slider); public slots: void search(SearchParams *searchParams); @@ -78,6 +81,14 @@ private slots: #ifdef APP_DEMO void demoMessage(); #endif + void startPlaying(); + void downloadStatusChanged(); + + /* + void downloadProgress(int percent); + void sliderMoved(int value); + void seekTo(int value); + */ private: @@ -114,6 +125,9 @@ private: QTimer *demoTimer; #endif + DownloadItem *downloadItem; + // QSlider *slider; + }; #endif // __MEDIAVIEW_H__ diff --git a/src/SearchView.cpp b/src/SearchView.cpp index d1907f0..76f7da4 100644 --- a/src/SearchView.cpp +++ b/src/SearchView.cpp @@ -135,9 +135,18 @@ void SearchView::updateRecentKeywords() { The::globalActions()->value("clearRecentKeywords")->setEnabled(!keywords.isEmpty()); foreach (QString keyword, keywords) { - QLabel *itemLabel = new QLabel(" 0 && separator + 1 < keyword.length()) { + link = keyword.left(separator); + display = keyword.mid(separator+1); + } + } + QLabel *itemLabel = new QLabel("" - + keyword + "", this); + + display + "", this); itemLabel->setMaximumWidth(queryEdit->width() + watchButton->width()); // itemLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); diff --git a/src/downloaditem.cpp b/src/downloaditem.cpp index ab92fc3..1219fb4 100644 --- a/src/downloaditem.cpp +++ b/src/downloaditem.cpp @@ -99,7 +99,6 @@ void DownloadItem::downloadReadyRead() { emit statusChanged(); } - m_status = Downloading; if (-1 == m_file.write(m_reply->readAll())) { /* downloadInfoLabel->setText(tr("Error saving: %1") @@ -108,7 +107,10 @@ void DownloadItem::downloadReadyRead() { */ } else { m_startedSaving = true; - if (m_finishedDownloading) + if (m_status != Downloading) { + // m_status = Downloading; + // emit statusChanged(); + } else if (m_finishedDownloading) requestFinished(); } } @@ -157,6 +159,14 @@ void DownloadItem::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) { percent = bytesReceived * 100 / bytesTotal; } + // qDebug() << bytesReceived << bytesTotal; + if (m_status != Downloading + && bytesReceived > 1024 * 512 + && bytesReceived > bytesTotal * .01) { + m_status = Downloading; + emit statusChanged(); + } + emit progress(percent); // emit statusChanged(); } diff --git a/src/downloaditem.h b/src/downloaditem.h index 1d6b1f1..7ccf4db 100644 --- a/src/downloaditem.h +++ b/src/downloaditem.h @@ -31,6 +31,7 @@ public: double currentSpeed() const; int currentPercent() const { return percent; } Video* getVideo() const { return video; } + QString currentFilename() const { return m_file.fileName(); } DownloadItemStatus status() const { return m_status; } static QString formattedFilesize(qint64 size); static QString formattedSpeed(double speed); diff --git a/src/networkaccess.cpp b/src/networkaccess.cpp index 378cb1a..4c4058e 100644 --- a/src/networkaccess.cpp +++ b/src/networkaccess.cpp @@ -6,9 +6,13 @@ namespace The { NetworkAccess* http(); } +/* const QString USER_AGENT = QString(Constants::APP_NAME) + " " + Constants::VERSION + " (" + Constants::WEBSITE + ")"; +*/ + +const QString USER_AGENT = "Mozilla/5.0 (X11; U; Linux x86; en-US; rv:1.9.2.12) Gecko/20101028 Firefox/3.6.12"; NetworkReply::NetworkReply(QNetworkReply *networkReply) : QObject(networkReply) { this->networkReply = networkReply; @@ -54,24 +58,20 @@ void NetworkReply::requestError(QNetworkReply::NetworkError code) { NetworkAccess::NetworkAccess( QObject* parent) : QObject( parent ) {} -QNetworkReply* NetworkAccess::simpleGet(QUrl url, int operation) { +QNetworkReply* NetworkAccess::manualGet(QNetworkRequest request, int operation) { QNetworkAccessManager *manager = The::networkAccessManager(); - QNetworkRequest request(url); - request.setRawHeader("User-Agent", USER_AGENT.toUtf8()); - request.setRawHeader("Connection", "Keep-Alive"); - QNetworkReply *networkReply; switch (operation) { case QNetworkAccessManager::GetOperation: - qDebug() << "GET" << url.toString(); + qDebug() << "GET" << request.url().toEncoded(); networkReply = manager->get(request); break; case QNetworkAccessManager::HeadOperation: - qDebug() << "HEAD" << url.toString(); + qDebug() << "HEAD" << request.url().toEncoded(); networkReply = manager->head(request); break; @@ -86,7 +86,18 @@ QNetworkReply* NetworkAccess::simpleGet(QUrl url, int operation) { this, SLOT(error(QNetworkReply::NetworkError))); return networkReply; +} + +QNetworkReply* NetworkAccess::simpleGet(QUrl url, int operation) { + + QNetworkRequest request(url); + request.setRawHeader("User-Agent", USER_AGENT.toUtf8()); + request.setRawHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); + request.setRawHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); + request.setRawHeader("Accept-Language", "en-us,en;q=0.5"); + // request.setRawHeader("Connection", "Keep-Alive"); + return manualGet(request, operation); } NetworkReply* NetworkAccess::get(const QUrl url) { diff --git a/src/networkaccess.h b/src/networkaccess.h index 64cf508..58e55e3 100644 --- a/src/networkaccess.h +++ b/src/networkaccess.h @@ -1,6 +1,7 @@ #ifndef NETWORKACCESS_H #define NETWORKACCESS_H +#include #include namespace The { @@ -35,6 +36,7 @@ class NetworkAccess : public QObject { public: NetworkAccess( QObject* parent=0); + QNetworkReply* manualGet(QNetworkRequest request, int operation = QNetworkAccessManager::GetOperation); QNetworkReply* simpleGet(QUrl url, int operation = QNetworkAccessManager::GetOperation); NetworkReply* get(QUrl url); NetworkReply* head(QUrl url); diff --git a/src/video.cpp b/src/video.cpp index 35e8371..7b7a803 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -102,6 +102,8 @@ void Video::getVideoInfo() { void Video::gotVideoInfo(QByteArray data) { QString videoInfo = QString::fromUtf8(data); + // qDebug() << "videoInfo" << videoInfo; + // get video token QRegExp re = QRegExp("^.*&token=([^&]+).*$"); bool match = re.exactMatch(videoInfo); @@ -118,7 +120,6 @@ void Video::gotVideoInfo(QByteArray data) { // qDebug() << "videoToken" << videoToken; this->videoToken = videoToken; - /* // get fmt_url_map re = QRegExp("^.*&fmt_url_map=([^&]+).*$"); match = re.exactMatch(videoInfo); @@ -129,32 +130,54 @@ void Video::gotVideoInfo(QByteArray data) { getVideoInfo(); return; } + QString fmtUrlMap = re.cap(1); + fmtUrlMap = QByteArray::fromPercentEncoding(fmtUrlMap.toUtf8()); - while (fmtUrlMap.contains('%')) - fmtUrlMap = QByteArray::fromPercentEncoding(fmtUrlMap.toAscii()); + QSettings settings; + QString definitionName = settings.value("definition").toString(); + int definitionCode = VideoDefinition::getDefinitionCode(definitionName); - qDebug() << "fmtUrlMap" << fmtUrlMap; + // qDebug() << "fmtUrlMap" << fmtUrlMap; QStringList formatUrls = fmtUrlMap.split(",", QString::SkipEmptyParts); + QHash urlMap; foreach(QString formatUrl, formatUrls) { int separator = formatUrl.indexOf("|"); if (separator == -1) continue; int format = formatUrl.left(separator).toInt(); QString url = formatUrl.mid(separator + 1); - qDebug() << format << url; + + if (format == definitionCode) { + QUrl videoUrl = QUrl::fromEncoded(url.toUtf8(), QUrl::StrictMode); + m_streamUrl = videoUrl; + emit gotStreamUrl(videoUrl); + loadingStreamUrl = false; + return; + } + + urlMap.insert(format, url); } - */ - QSettings settings; - QString definitionName = settings.value("definition").toString(); - int definitionCode = VideoDefinition::getDefinitionCode(definitionName); - if (definitionCode == 18) { - // This is assumed always available - foundVideoUrl(videoToken, 18); - } else { - findVideoUrl(definitionCode); + QList definitionCodes = VideoDefinition::getDefinitionCodes(); + int currentIndex = definitionCodes.indexOf(definitionCode); + int previousIndex = 0; + while (currentIndex >= 0) { + previousIndex = currentIndex - 1; + int definitionCode = definitionCodes.at(previousIndex); + if (urlMap.contains(definitionCode)) { + qDebug() << "Found format" << definitionCode; + QString url = urlMap.value(definitionCode); + QUrl videoUrl = QUrl::fromEncoded(url.toUtf8(), QUrl::StrictMode); + m_streamUrl = videoUrl; + emit gotStreamUrl(videoUrl); + loadingStreamUrl = false; + return; + } + currentIndex--; } + emit errorStreamUrl(tr("Cannot get video stream for %1").arg(m_webpage.toString())); + } void Video::foundVideoUrl(QString videoToken, int definitionCode) {