1
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-09-20 11:20:52 +02:00

Compare commits

...

265 Commits

Author SHA1 Message Date
Selim
bf7dc462e8 Translated using Weblate (Turkish)
Currently translated at 100% (0 of 0 strings)

Created new translation.
2016-02-22 13:46:14 +01:00
Christian Schabesberger
65b6aaec8e moved on to 0.7.6 2016-02-21 22:57:07 +01:00
Christian Schabesberger
e08aa14eab better detection for livestreams 2016-02-21 22:25:45 +01:00
Christian Schabesberger
851028997a fixed json error from the last commit 2016-02-21 21:15:39 +01:00
Christian Schabesberger
a1479d04df fixed some searchengine errors 2016-02-21 21:08:14 +01:00
Christian Schabesberger
2995a7dc8f actual fix for androi 6.0 notification problem
Notification buttons weren't respondig to clicks. Now they do.
2016-02-21 18:12:00 +01:00
Christian Schabesberger
819db0a30b antifix for android 6.0 notification z order problem 2016-02-21 17:55:00 +01:00
Weblate
d8281aeb34 Merge remote-tracking branch 'origin/master' 2016-02-21 01:40:55 +01:00
LelixSuper
cd0f2061b5 Translated using Weblate (Italian)
Currently translated at 100.0% (68 of 68 strings)
2016-02-21 01:40:55 +01:00
Christian Schabesberger
96928d46ca Merge pull request #199 from szafir1100/develop
used regex to delete spaces inside parseLong() argument
2016-02-21 01:40:50 +01:00
LelixSuper
6d55ac2199 Translated using Weblate (Italian)
Currently translated at 100.0% (68 of 68 strings)
2016-02-20 15:16:59 +01:00
Tomasz Marzeion
80dae6ece7 used regex to delete spaces inside parseLong() argument 2016-02-20 13:49:47 +01:00
Matej U
a1a12ca9f7 Translated using Weblate (Slovenian)
Currently translated at 100.0% (68 of 68 strings)
2016-02-19 15:46:49 +01:00
Christian Schabesberger
5a594173fa Merge pull request #193 from satiricon/fix-autoplay
Fix ArrayIndexOutOfBoundsException when using autoplay
2016-02-19 15:14:06 +01:00
Christian Schabesberger
1e989945b9 moved on to 0.7.5 2016-02-19 14:40:49 +01:00
Christian Schabesberger
679bef849c Merge branch 'master' of github.com:theScrabi/NewPipe 2016-02-19 14:40:20 +01:00
Christian Schabesberger
1c17be9760 made new notification layout available for older platforms 2016-02-19 13:22:49 +01:00
naofum
6def0e3115 Translated using Weblate (Japanese)
Currently translated at 100.0% (68 of 68 strings)
2016-02-19 12:51:38 +01:00
David
fd3436d5c0 Fix ArrayIndexOutOfBoundsException when using autoplay 2016-02-18 13:40:26 -03:00
Christian Schabesberger
a94f9fd3e5 made the ui react on missing information 2016-02-18 13:49:01 +01:00
Christian Schabesberger
77850464d4 renamed crawler into extractor 2016-02-18 11:50:22 +01:00
Christian Schabesberger
3e9edba189 fix broken unit test 2016-02-18 11:47:21 +01:00
Christian Schabesberger
3d168542fe add arabic translation 2016-02-18 00:00:47 +01:00
Christian Schabesberger
0de00e26d8 Merge branch 'master' of github.com:theScrabi/NewPipe 2016-02-17 23:55:32 +01:00
Christian Schabesberger
f0705c612e removed play fab button 2016-02-17 23:55:19 +01:00
Christian Schabesberger
648b9b5d02 made the ui more accommodating for not available audio streams 2016-02-17 21:39:41 +01:00
Christian Schabesberger
b15a0b92f9 add support for attribution_link links 2016-02-17 20:29:31 +01:00
Christian Schabesberger
80482c0578 made settings_keys unsupportable 2016-02-17 19:23:23 +01:00
Weblate
16701923a1 Merge remote-tracking branch 'origin/master' 2016-02-17 19:21:20 +01:00
kamadi
67cee06523 Translated using Weblate (Russian)
Currently translated at 80.5% (54 of 67 strings)
2016-02-17 19:21:20 +01:00
Omar Kharrab
685dab39af Translated using Weblate (French)
Currently translated at 97.0% (65 of 67 strings)
2016-02-17 19:21:19 +01:00
David Duong
0ff9555cc4 Translated using Weblate (Czech)
Currently translated at 100.0% (67 of 67 strings)
2016-02-17 18:44:14 +01:00
Robin van der Vliet
4f808dd17d Translated using Weblate (Dutch)
Currently translated at 65.6% (44 of 67 strings)
2016-02-17 00:44:16 +01:00
vadin
69d71dac36 Translated using Weblate (Spanish)
Currently translated at 100.0% (67 of 67 strings)
2016-02-16 23:18:33 +01:00
Jossi Wolf
4880319991 Translated using Weblate (German)
Currently translated at 98.5% (66 of 67 strings)
2016-02-16 21:44:52 +01:00
Robin van der Vliet
13b9850b39 Translated using Weblate (Esperanto)
Currently translated at 100.0% (67 of 67 strings)

Imperative because it is a command to the user.
2016-02-16 17:29:05 +01:00
Robin van der Vliet
366f645eda Translated using Weblate (Esperanto)
Currently translated at 97.0% (65 of 67 strings)

Translated "media center" just as "application", if somebody has a better translation please change it.
2016-02-16 17:28:40 +01:00
Robin van der Vliet
dcf7190c90 Translated using Weblate (Esperanto)
Currently translated at 91.0% (61 of 67 strings)

elŝutujo = container for downloads
2016-02-16 17:22:13 +01:00
Robin van der Vliet
ae6647276c Translated using Weblate (Esperanto)
Currently translated at 86.5% (58 of 67 strings)

A bit long
2016-02-16 17:14:35 +01:00
Robin van der Vliet
460ff37f7a Translated using Weblate (Esperanto)
Currently translated at 79.1% (53 of 67 strings)

A bit long because
2016-02-16 17:05:14 +01:00
Robin van der Vliet
e7ef913416 Translated using Weblate (Esperanto)
Currently translated at 77.6% (52 of 67 strings)

Added "the app" because the accusative cannot really go on the word "Kore"
2016-02-16 17:03:53 +01:00
Robin van der Vliet
c149050a3a Translated using Weblate (Esperanto)
Currently translated at 71.6% (48 of 67 strings)

Added "the app" because the accusative cannot really go on the word "VLC"
2016-02-16 16:59:18 +01:00
Robin van der Vliet
a4e5ca54db Translated using Weblate (Esperanto)
Currently translated at 70.1% (47 of 67 strings)

Intent untranslated because there is not really a common translation. If somebody has a better translation, please change it.
2016-02-16 16:58:13 +01:00
Robin van der Vliet
cb81fd3353 Translated using Weblate (Esperanto)
Currently translated at 68.6% (46 of 67 strings)

Added "the program" because the accusative cannot really go on the word "Tor"
2016-02-16 16:57:28 +01:00
David Duong
352a883b5d Translated using Weblate (Czech)
Currently translated at 100.0% (67 of 67 strings)
2016-02-15 18:04:52 +01:00
David Duong
5247b22ef4 Translated using Weblate (Czech)
Currently translated at 100% (0 of 0 strings)

Created new translation.
2016-02-15 17:33:44 +01:00
Robin van der Vliet
1bf00e80b0 Translated using Weblate (Esperanto)
Currently translated at 67.1% (45 of 67 strings)
2016-02-14 23:57:46 +01:00
Robin van der Vliet
6331d9b7a4 Translated using Weblate (Esperanto)
Currently translated at 100% (0 of 0 strings)

Created new translation.
2016-02-14 23:44:51 +01:00
Marian Hanzel
0deb0ad851 Translated using Weblate (Slovak)
Currently translated at 100.0% (67 of 67 strings)
2016-02-14 21:45:11 +01:00
Matej U
3b42041c4e Translated using Weblate (Slovenian)
Currently translated at 100.0% (67 of 67 strings)
2016-02-14 21:23:03 +01:00
Benedikt Freisen
d8987aa94a Translated using Weblate (German)
Currently translated at 98.5% (66 of 67 strings)

Where readable and unambiguous, the compound-noun-spelling without hyphen is usually preferred.
2016-02-14 21:06:39 +01:00
Mladen Pejaković
19ed16efc6 Translated using Weblate (Serbian)
Currently translated at 100.0% (67 of 67 strings)
2016-02-14 11:33:57 +01:00
Benedikt Freisen
0e32d70aef Translated using Weblate (German)
Currently translated at 98.5% (66 of 67 strings)
2016-02-12 22:59:12 +01:00
Marian Hanzel
5b71f279fd Translated using Weblate (Slovak)
Currently translated at 100.0% (67 of 67 strings)
2016-02-12 19:59:06 +01:00
Marian Hanzel
6d170ffb16 Translated using Weblate (Slovak)
Currently translated at 100% (0 of 0 strings)

Created new translation.
2016-02-12 19:29:38 +01:00
Christian Schabesberger
72d90374a0 moved on to 0.7.4 2016-02-12 15:32:16 +01:00
Christian Schabesberger
fc8160acda fixed autoplay bug 2016-02-12 15:29:11 +01:00
Christian Schabesberger
751ffb9de9 quick and dirty solution for download/audio bug
Youtube has changed (again) this time it was a bit harder,
therfor the changes are deeper. May be still a bit unstable.
2016-02-12 01:29:14 +01:00
Christian Schabesberger
60d636940d set orbot/tor support into experimental status 2016-02-10 12:09:43 +01:00
Christian Schabesberger
7a5cca519a Merge branch 'master' of github.com:theScrabi/NewPipe 2016-02-08 18:46:56 +01:00
Christian Schabesberger
1e93d06a25 restructured ActionbarHandler 2016-02-08 18:46:42 +01:00
naofum
4341f8aaec Translated using Weblate (Japanese)
Currently translated at 100.0% (67 of 67 strings)
2016-02-08 12:44:42 +01:00
Licaon Kter
46022d60f3 Translated using Weblate (Romanian)
Currently translated at 100% (0 of 0 strings)

Created new translation.
2016-02-07 22:16:35 +01:00
Sérgio Marques
80ddc76926 Translated using Weblate (Portuguese)
Currently translated at 100.0% (67 of 67 strings)
2016-02-06 23:07:05 +01:00
naofum
bd999b4b0a Translated using Weblate (Japanese)
Currently translated at 100.0% (67 of 67 strings)
2016-02-06 11:42:08 +01:00
Christian Schabesberger
4cdc387338 Merge branch 'master' of github.com:theScrabi/NewPipe 2016-02-05 17:14:18 +01:00
Christian Schabesberger
df258a0003 Merge branch 'algoprog-master' 2016-02-05 17:10:00 +01:00
Christian Schabesberger
7cc1c0fbdd merge code, and adjust code 2016-02-05 17:09:29 +01:00
Mladen Pejaković
42644c956b Translated using Weblate (Serbian)
Currently translated at 100.0% (67 of 67 strings)
2016-02-05 14:50:14 +01:00
Weblate
00eaedcbfa Merge remote-tracking branch 'origin/master' 2016-02-05 14:38:53 +01:00
Chris Samarinas
1ff5a97c85 Translated using Weblate (Greek)
Currently translated at 100.0% (61 of 61 strings)
2016-02-05 14:38:52 +01:00
Christian Schabesberger
241414f81b Merge pull request #167 from theScrabi/crawlerRefactor
Crawler refactor
2016-02-05 14:38:48 +01:00
Christian Schabesberger
1bf046a8ba made all arrays into lists 2016-02-05 14:09:04 +01:00
Christian Schabesberger
61471fdd3c renamed UrlIdHandler into VideoUrlIdHandler 2016-02-05 13:34:44 +01:00
Allan Nordhøy
a0524fb136 Translated using Weblate (Norwegian Bokmål)
Currently translated at 100.0% (61 of 61 strings)
2016-02-05 01:55:35 +01:00
Allan Nordhøy
fa39389a64 Translated using Weblate (Norwegian Bokmål)
Currently translated at 100% (0 of 0 strings)

Created new translation.
2016-02-05 01:38:27 +01:00
Chris Samarinas
697a24e699 Translated using Weblate (Greek)
Currently translated at 100.0% (61 of 61 strings)
2016-02-04 06:10:42 +01:00
Chris Samarinas
cf3bb87a54 Translated using Weblate (Greek)
Currently translated at 100% (0 of 0 strings)

Created new translation.
2016-02-04 05:46:47 +01:00
Christian Schabesberger
14fb7d8a7a fixed failing tests 2016-02-02 19:01:53 +01:00
Christian Schabesberger
d097363b24 restructure parser 2016-02-02 18:43:20 +01:00
Christian Schabesberger
bad576c23d got rid of getVideoInfo() in youtube crawler 2016-02-02 14:06:09 +01:00
Weblate
8d9e4e7442 Merge remote-tracking branch 'origin/master' 2016-02-01 13:44:46 +01:00
Christian Schabesberger
431d03c63f Merge branch 'master' of github.com:theScrabi/NewPipe 2016-02-01 13:46:01 +01:00
Christian Schabesberger
24321731d9 Merge branch 'iit2014086-master' 2016-02-01 13:45:44 +01:00
Christian Schabesberger
fddcade1fb removed unnececeary call of setVolumeControlStream() 2016-02-01 13:45:22 +01:00
theshayy
a0aa7dcdc1 Translated using Weblate (French)
Currently translated at 100.0% (61 of 61 strings)
2016-02-01 13:44:46 +01:00
Teja Vojjala
d3e9f354b3 Update SettingsActivity.java 2016-02-01 15:00:08 +05:30
Teja Vojjala
e958334406 Update VideoItemListActivity.java 2016-02-01 14:29:49 +05:30
Teja Vojjala
a42029970d Update VideoItemDetailActivity.java 2016-02-01 14:29:28 +05:30
Teja Vojjala
2108e09e13 Update PlayVideoActivity.java 2016-02-01 14:28:38 +05:30
Teja Vojjala
8c010093e8 Update SettingsActivity.java 2016-02-01 14:27:24 +05:30
Teja Vojjala
adc98be441 Update PanicResponderActivity.java 2016-02-01 14:25:23 +05:30
Christian Schabesberger
fb942912db disable gema test agian 2016-01-31 20:16:21 +01:00
Christian Schabesberger
7f12b58722 use java error system in the crawler 2016-01-31 19:57:30 +01:00
Éfrit
05d58f8f98 Translated using Weblate (French)
Currently translated at 100.0% (61 of 61 strings)
2016-01-31 12:49:00 +01:00
Christian Schabesberger
46c2db310a add suport for dash 2016-01-30 00:22:16 +01:00
Teja Vojjala
607408b9b9 Update PanicResponderActivity.java 2016-01-29 20:21:44 +05:30
Teja Vojjala
b81e8cb81a Update SettingsActivity.java 2016-01-29 20:20:55 +05:30
Teja Vojjala
44ef04d90a Update PlayVideoActivity.java 2016-01-29 20:19:09 +05:30
Teja Vojjala
3e9d84b109 Merge pull request #2 from iit2014086/iit2014086-patch-2
Update VideoItemDetailActivity.java
2016-01-29 20:17:24 +05:30
Teja Vojjala
aa2d8d4833 Update VideoItemDetailActivity.java 2016-01-29 20:16:57 +05:30
Teja Vojjala
55f63b948b Merge pull request #1 from iit2014086/iit2014086-patch-1
Update VideoItemListActivity.java
2016-01-29 20:09:13 +05:30
Teja Vojjala
cece543d6b Update VideoItemListActivity.java 2016-01-29 20:07:15 +05:30
Christian Schabesberger
9204a89319 fiexed some licence headers 2016-01-28 23:27:16 +01:00
Christian Schabesberger
f8ed96bb25 renamed services into crawer 2016-01-28 21:34:35 +01:00
Christian Schabesberger
54d318bf04 detatch android related downloader from crawler 2016-01-28 21:21:19 +01:00
Christian Schabesberger
f152d66cd8 fixed some bugs 2016-01-28 12:10:50 +01:00
Sérgio Marques
576786c751 Translated using Weblate (Portuguese)
Currently translated at 100.0% (61 of 61 strings)
2016-01-19 00:22:40 +01:00
halcyonest
a6b7cd3202 Translated using Weblate (Korean)
Currently translated at 100.0% (61 of 61 strings)
2016-01-16 12:44:51 +01:00
Yoo
ea9caaaaf0 Translated using Weblate (Hungarian)
Currently translated at 96.7% (59 of 61 strings)
2016-01-14 21:44:37 +01:00
Matej U
22d8f434be Translated using Weblate (Slovenian)
Currently translated at 100.0% (61 of 61 strings)
2016-01-14 15:45:12 +01:00
halcyonest
8360c10141 Translated using Weblate (Korean)
Currently translated at 100.0% (61 of 61 strings)
2016-01-12 10:14:37 +01:00
Matej U
750dc6f2cc Translated using Weblate (Slovenian)
Currently translated at 100.0% (61 of 61 strings)
2016-01-10 14:22:05 +01:00
riotism
47b556544d Translated using Weblate (Chinese (Taiwan))
Currently translated at 100.0% (61 of 61 strings)
2016-01-09 23:06:53 +01:00
riotism
f6cee739a6 Translated using Weblate (Chinese (Hong Kong))
Currently translated at 100.0% (61 of 61 strings)
2016-01-09 23:02:34 +01:00
riotism
d1afe0028c Translated using Weblate (Chinese (China))
Currently translated at 100.0% (61 of 61 strings)
2016-01-09 22:59:42 +01:00
M2ck
a4cace1ef7 Translated using Weblate (French)
Currently translated at 100.0% (61 of 61 strings)
2016-01-09 20:55:00 +01:00
red
707ac8be27 Translated using Weblate (French)
Currently translated at 81.9% (50 of 61 strings)
2016-01-09 20:37:38 +01:00
Weblate
2f2254966a Merge remote-tracking branch 'origin/master' 2016-01-09 15:04:05 +01:00
Christian Schabesberger
eb57675f55 Translated using Weblate (German)
Currently translated at 100.0% (61 of 61 strings)
2016-01-09 15:04:05 +01:00
Christian Schabesberger
dde93c5ccf Translated using Weblate (English)
Currently translated at 100.0% (61 of 61 strings)
2016-01-09 15:04:05 +01:00
Christian Schabesberger
886b5959f7 Merge pull request #149 from narutosanjiv/master
ProgressBar must stop incase of network failure
2016-01-09 15:04:02 +01:00
naofum
dc44546ac7 Translated using Weblate (Japanese)
Currently translated at 100.0% (61 of 61 strings)
2016-01-09 13:38:56 +01:00
Sanjiv Jha
42c6698732 ProgressBar must stop incase of network failure in videolist & detail page 2016-01-09 16:39:31 +05:30
Mladen Pejaković
bd014a107f Translated using Weblate (Serbian)
Currently translated at 100.0% (61 of 61 strings)
2016-01-09 02:36:00 +01:00
Christian Schabesberger
3a7298bb99 Translated using Weblate (German)
Currently translated at 100.0% (61 of 61 strings)
2016-01-09 00:09:55 +01:00
Christian Schabesberger
aa06e3490d Merge branch 'master' of github.com:theScrabi/NewPipe 2016-01-08 22:22:55 +01:00
Christian Schabesberger
ece889b36b moved on to 0.7.3 2016-01-08 22:22:39 +01:00
Christian Schabesberger
9848f19ce6 Merge github.com:k3b/NewPipe into k3bMaster 2016-01-08 22:04:42 +01:00
Weblate
e59b087057 Merge remote-tracking branch 'origin/master' 2016-01-08 22:00:27 +01:00
Greg
5b451d1ac7 Translated using Weblate (Spanish)
Currently translated at 64.2% (36 of 56 strings)
2016-01-08 22:00:27 +01:00
Greg
f050c05b3c Translated using Weblate (Russian)
Currently translated at 98.2% (55 of 56 strings)
2016-01-08 22:00:27 +01:00
Sérgio Marques
06b8edefbf Translated using Weblate (Portuguese)
Currently translated at 100.0% (56 of 56 strings)
2016-01-08 22:00:26 +01:00
Greg
f3a2a28398 Translated using Weblate (German)
Currently translated at 91.0% (51 of 56 strings)
2016-01-08 22:00:26 +01:00
Greg
9b0a1fc2ec Translated using Weblate (English)
Currently translated at 100.0% (56 of 56 strings)
2016-01-08 22:00:26 +01:00
riotism
c87ab234eb Translated using Weblate (Chinese (Taiwan))
Currently translated at 100.0% (56 of 56 strings)
2016-01-08 22:00:25 +01:00
riotism
68468756a8 Translated using Weblate (Chinese (Hong Kong))
Currently translated at 100.0% (56 of 56 strings)
2016-01-08 22:00:24 +01:00
riotism
9016df0195 Translated using Weblate (Chinese (China))
Currently translated at 100.0% (56 of 56 strings)
2016-01-08 22:00:24 +01:00
Christian Schabesberger
7acece9705 Merge pull request #145 from 42SK/master
Fixed #143
2016-01-08 22:00:21 +01:00
red
d1896c23c0 Translated using Weblate (French)
Currently translated at 100.0% (56 of 56 strings)
2016-01-08 14:04:29 +01:00
riotism
dae19f03e0 Translated using Weblate (Chinese (China))
Currently translated at 100.0% (56 of 56 strings)
2016-01-07 23:07:42 +01:00
riotism
9dafccf0f7 Translated using Weblate (Chinese (China))
Currently translated at 100% (0 of 0 strings)

Created new translation.
2016-01-07 22:46:44 +01:00
riotism
5f270c41ae Translated using Weblate (Chinese (Taiwan))
Currently translated at 100.0% (56 of 56 strings)
2016-01-07 22:46:12 +01:00
riotism
f9f80e9003 Translated using Weblate (Chinese (Taiwan))
Currently translated at 100% (0 of 0 strings)

Created new translation.
2016-01-07 22:08:02 +01:00
riotism
c5063d4269 Translated using Weblate (Chinese (Hong Kong))
Currently translated at 100.0% (56 of 56 strings)
2016-01-07 22:06:57 +01:00
riotism
ccbe18ec1c Translated using Weblate (Chinese (Hong Kong))
Currently translated at 100% (0 of 0 strings)

Created new translation.
2016-01-07 21:21:58 +01:00
k3b
321a8a8b25 Translated using Weblate (German)
Currently translated at 91.0% (51 of 56 strings)
2016-01-07 20:20:57 +01:00
k3b
77a9560376 #143 #44 #42 #22: Fixed some download problems with invalid directories or filenames. Added user Feedback. Different settings for audio and video download dir. 2016-01-07 14:32:16 +01:00
k3b
058a039a82 #143 #44 #42 #22: Fixed some download problems with invalid directories or filenames. Added user Feedback. Different settings for audio and video download dir. 2016-01-07 14:22:55 +01:00
naofum
7c744703e4 Translated using Weblate (Japanese)
Currently translated at 100.0% (56 of 56 strings)
2016-01-07 14:15:56 +01:00
42SK
a934cbb085 Fixed #143 2016-01-07 13:28:17 +01:00
Sérgio Marques
cf4158c0d0 Translated using Weblate (Portuguese)
Currently translated at 100.0% (56 of 56 strings)
2016-01-07 00:48:13 +01:00
M2ck
dc56eab9b6 Translated using Weblate (French)
Currently translated at 100.0% (56 of 56 strings)
2016-01-06 16:47:54 +01:00
Weblate
37d1f59132 Merge remote-tracking branch 'origin/master' 2016-01-06 15:13:03 +01:00
Christian Schabesberger
ab0ce55411 merge unitTesting 2016-01-06 15:13:55 +01:00
Matej U
c1d66596d1 Translated using Weblate (Slovenian)
Currently translated at 100.0% (56 of 56 strings)
2016-01-06 15:13:03 +01:00
Mladen Pejaković
cbfccdf0d3 Translated using Weblate (Serbian)
Currently translated at 100.0% (56 of 56 strings)
2016-01-06 15:13:02 +01:00
Christian Schabesberger
9362037177 remove theme option since it's not yet working 2016-01-06 15:00:33 +01:00
Matej U
e25c93bae2 Translated using Weblate (Slovenian)
Currently translated at 100.0% (56 of 56 strings)
2016-01-06 09:28:10 +01:00
Mladen Pejaković
367c434010 Translated using Weblate (Serbian)
Currently translated at 100.0% (56 of 56 strings)
2016-01-05 23:54:30 +01:00
chschtsch
02d8463e15 rename resource 2016-01-06 00:02:10 +03:00
Christian Schabesberger
9d5a1d5c43 removed unnececeary comment 2016-01-05 21:54:40 +01:00
Christian Schabesberger
c8d94f541f resolved merge conflict 2016-01-05 21:50:25 +01:00
Christian Schabesberger
27d06eaa6b removed hardcoded string, and add licece to some files. 2016-01-05 21:41:55 +01:00
Christian Schabesberger
7f32857e00 buxfix 2016-01-05 21:23:16 +01:00
chschtsch
2f060f0f52 merging with eb0df2b 2016-01-05 23:16:50 +03:00
chschtsch
f89d405226 merging with eb0df2b 2016-01-05 23:13:52 +03:00
chschtsch
fd4459e570 Merge branch 'master' of github.com:theScrabi/NewPipe 2016-01-05 23:12:22 +03:00
Christian Schabesberger
eb0df2b101 set download path on startup 2016-01-05 21:11:15 +01:00
chschtsch
6c178cfb7e add back missing like button margin 2016-01-05 23:09:15 +03:00
chschtsch
8ced68430d update resources names to match naming convention & cleanup & start working on themes 2016-01-05 22:56:40 +03:00
Aitor Beriain
0aade598ff Translated using Weblate (Basque)
Currently translated at 100.0% (53 of 53 strings)
2016-01-04 20:02:01 +01:00
Aitor Beriain
95949fd1ab Translated using Weblate (Basque)
Currently translated at 100% (0 of 0 strings)

Created new translation.
2016-01-04 19:35:11 +01:00
naofum
1a56382112 Translated using Weblate (Japanese)
Currently translated at 100.0% (53 of 53 strings)
2016-01-04 11:51:32 +01:00
Adam Howard
d610e4b19b minor code tweaks to BackgroundPlayer 2016-01-04 01:51:24 +00:00
Adam Howard
fc44d9e36e Merge branch 'master' of github.com:theScrabi/NewPipe 2016-01-04 01:15:33 +00:00
Adam Howard
c07686576a possible fix for expandedView bug in BackgroundPlayer 2016-01-04 01:15:13 +00:00
Weblate
c2400aea4d Merge remote-tracking branch 'origin/master' 2016-01-04 00:11:51 +01:00
Benedikt Geißler
fb4bf0dde4 Translated using Weblate (German)
Currently translated at 98.1% (52 of 53 strings)
2016-01-04 00:11:51 +01:00
Christian Schabesberger
e4f638d1ce Merge branch 'master' of github.com:theScrabi/NewPipe 2016-01-04 00:11:00 +01:00
Christian Schabesberger
5c492c01a1 adjusted orbot support and moved on to 0.7.2 2016-01-04 00:10:51 +01:00
M2ck
f451e11f82 Translated using Weblate (French)
Currently translated at 100.0% (53 of 53 strings)
2016-01-03 20:55:44 +01:00
Adam Howard
95b73f35f7 Merge branch 'master' of github.com:theScrabi/NewPipe 2016-01-03 19:44:13 +00:00
Adam Howard
58147e9e12 removed commented code in BackgroundPlayer 2016-01-03 19:44:04 +00:00
Christian Schabesberger
a8830e2ede preference screen previews set values 2016-01-03 19:55:04 +01:00
Mladen Pejaković
9804bb95cc Translated using Weblate (Serbian)
Currently translated at 100.0% (53 of 53 strings)
2016-01-03 19:12:16 +01:00
Christian Schabesberger
0da1aef763 Merge pull request #136 from eighthave/tor-support-for-all-except-streaming
Tor support for all except streaming
2016-01-03 17:40:02 +01:00
M2ck
0a334804a3 Translated using Weblate (French)
Currently translated at 100.0% (51 of 51 strings)
2016-01-03 16:56:51 +01:00
naofum
94d2f03e9b Translated using Weblate (Japanese)
Currently translated at 100.0% (51 of 51 strings)
2016-01-03 10:31:40 +01:00
Hans-Christoph Steiner
9127f7f0c2 make progress notification for Tor downloader (closes #39) 2016-01-03 00:04:55 +01:00
Hans-Christoph Steiner
0bb0226bc2 download files via Tor when Tor is enabled
DownloadManager does not let you set its proxy or change how it connects to
the internet.  So we have to make a custom one, unfortunately.  This is a
very basic downloader with none of the special sauce that makes the
built-in DownloadManager handy.
2016-01-02 22:47:21 +01:00
Hans-Christoph Steiner
b3a1a5dcc2 Android provides global vars for the actual download directories 2016-01-02 21:53:48 +01:00
Hans-Christoph Steiner
984dd1cc25 checking on "Use Tor" when Orbot is not installed starts install
If the user turns on "Use Tor" and they are missing Orbot, bring them to
the screen to install Tor.
2016-01-02 21:21:34 +01:00
Hans-Christoph Steiner
5663e543a4 whenever an Activity resumes and tor is enabled, request it start
This makes sure that Orbot is running when the user expects it to be. If
NewPipe is configured to use Tor, then going to a NewPipe screen should
ensure Tor is running.
2016-01-02 21:21:34 +01:00
Hans-Christoph Steiner
d3879a0398 setup Tor at app start, and config immediately when pref is changed
This adds an Application subclass to get the onCreate() method, which is
called once at the first start up of the app, before any Activity starts.
Tor is configured there to ensure it is setup before anything happens.

This also moves the "Use Tor" pref listener to a more appropriate place.
2016-01-02 21:21:34 +01:00
Hans-Christoph Steiner
6bd2468d44 if Orbot is installed, then default to using Tor
If the user has not changed the "Use Tor" preference, then the default
should be to use Tor if Orbot is installed. The user can still override it
by going an unchecking "Use Tor".
2016-01-02 21:21:34 +01:00
Hans-Christoph Steiner
e63d43151b add a title plus summary to "Use Tor" preference 2016-01-02 21:21:33 +01:00
Hans-Christoph Steiner
0265da4ae6 use HttpsURLConnections since youtube.com always uses HTTPS
This helps enforce that the connection is encrypted. If for whatever reason
an unencrypted connection is created, an Exception will be thrown.
2016-01-02 21:21:28 +01:00
GDR!
ef255d12ae Test tor code 2016-01-02 20:22:05 +01:00
Matej U
eeb612f9a2 Translated using Weblate (Slovenian)
Currently translated at 100.0% (51 of 51 strings)
2016-01-02 19:48:51 +01:00
Mladen Pejaković
dfcb4edb81 Translated using Weblate (Serbian)
Currently translated at 100.0% (51 of 51 strings)
2016-01-02 18:04:01 +01:00
Christian Schabesberger
d3500e9036 removed onion routing from readme 2016-01-02 17:41:33 +01:00
Christian Schabesberger
adcb8c6469 add c3s thumbnail and moved on to 0.7.1 2016-01-02 17:40:58 +01:00
Christian Schabesberger
592eee7d3d Merge pull request #134 from eighthave/intent-filters-and-other-fixes
Intent filters and other fixes
2016-01-02 16:18:56 +01:00
Christian Schabesberger
7dadb2b26c fixed close notification problem 2016-01-02 16:08:18 +01:00
Hans-Christoph Steiner
7cbb135f28 include Tibetan as a language option
The Tibetan alphabet was only recently included on Android, so the language
name needs to also have the English there.  Otherwise it'll appear blank
on devices without Tibetan.
2016-01-02 12:15:56 +01:00
Hans-Christoph Steiner
966ac0673c gradle.properties is only commented out defaults, so remove from git
For anyone who tweaks this file for local settings, it becomes painful
to have it committed in git because those changes which are only
relevant to the local setup will show up in git as changed.
2016-01-02 01:35:29 +01:00
Hans-Christoph Steiner
d715eae0d1 route video downloads to "Movies" and audio to "Music"
use the standard Android folders when downloading files.
2016-01-02 01:34:18 +01:00
Hans-Christoph Steiner
ccdd13d136 youtube URLs can also come from media searches and NFC sends 2016-01-02 00:15:27 +01:00
Hans-Christoph Steiner
efe5de4c75 support youtube's custom URL schemes (vnd.youtube: and vnd.youtube.launch:) 2016-01-02 00:15:27 +01:00
Hans-Christoph Steiner
2a93e9bd2e precisely target these URLs https://www.youtube.com/watch?v=mS1gstS6YS8
These URLs have a Path that always starts with "/watch" so no need for a
pattern.  Also, everything after the "?" is considered the "Query String",
not the Path.  Anything after a "#" is the "Feature String".  The path
matching in IntentFilters only see the Path, and nothing from the "Query
String" or "Feature String".

these are the available kinds of URLs:
https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/YouTubeLinks/YouTubeLinks.html
2016-01-02 00:15:27 +01:00
Hans-Christoph Steiner
28dd53ae50 support another youtube URL format: https://www.youtube.com/v/mS1gstS6YS8
https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/YouTubeLinks/YouTubeLinks.html
2016-01-02 00:15:27 +01:00
Hans-Christoph Steiner
3c1e64d8dc simplify youtube URL IntentFilters
Each <data> elements applies to the whole IntentFilter, so there is no need
to declare the host, scheme, etc. multiple times within a single
IntentFilter.

Also, pathPrefix="/" will match all paths, so it is unnecessary.
2016-01-02 00:15:27 +01:00
Hans-Christoph Steiner
4fe3cb2bca use symlinks to provide alternate folders for Hebrew and Indonesian
These two languages must be included twice (iw/he and id/in)

For a full discussion of why, see:
https://gitlab.com/fdroid/fdroidclient/issues/139
https://stackoverflow.com/questions/5074769/cyanogenmod-translate-a-project/8470980#8470980
https://stackoverflow.com/questions/8393771/android-not-using-finding-my-hebrew-localization

I included a blank placeholder file for Indonesian, it can be simply
replaced by the real one, whenever that comes along.
2016-01-02 00:15:27 +01:00
Hans-Christoph Steiner
b31490c4e3 make all strings translatable 2016-01-02 00:14:35 +01:00
Hans-Christoph Steiner
5533f6ba86 use the standard "Movies" folder for downloads
On all of the devices that I've checked, there is a folder called "Movies"
on the SD Card by default.  NewPipe should use that standard location
since it is always downloading movies :).  People can always change that
via the preferences.

Also, this makes the defaults the same when creating the dir and when
setting the destination URL.
2016-01-02 00:14:11 +01:00
Weblate
8aa5f87a1c Merge remote-tracking branch 'origin/master' 2016-01-01 15:47:36 +01:00
Greg
6deb674377 Translated using Weblate (Hebrew)
Currently translated at 16.6% (8 of 48 strings)
2016-01-01 15:47:36 +01:00
Christian Schabesberger
12d1d998a3 Merge pull request #133 from eighthave/panic-button-support
allow "panic button" apps to wipe activity
2016-01-01 15:47:32 +01:00
Christian Schabesberger
d90162d06f ugly workaround for GEMA test failing 2016-01-01 15:43:06 +01:00
Christian Schabesberger
97c924341c inital YoutubeExtractor test 2016-01-01 15:26:03 +01:00
Hans-Christoph Steiner
e91fc225e1 after receiving panic trigger, quit remove from history
This makes the app fully exit, and removes it from the Recent Apps listing
with the goal of hiding whatever the user was currently watching, and/or
searching for.

PanicKit provides a common framework for creating "panic button" apps that
can trigger actions in "panic responder" apps.  In this case, the response
is to lock the app, if it has been configured to do so

https://dev.guardianproject.info/projects/panic/wiki
2015-12-31 21:53:14 +01:00
M2ck
43149fd832 Translated using Weblate (French)
Currently translated at 100.0% (48 of 48 strings)
2015-12-31 10:27:52 +01:00
Greg
78df579703 Translated using Weblate (Hebrew)
Currently translated at 100% (0 of 0 strings)

Created new translation.
2015-12-29 21:45:44 +01:00
Greg
f61b915894 Translated using Weblate (Russian)
Currently translated at 100.0% (48 of 48 strings)
2015-12-29 21:45:08 +01:00
Christian Schabesberger
cd3f405bff slightly improved YoutubeSearchEngineTest 2015-12-29 21:41:10 +01:00
Christian Schabesberger
7cfdca7a81 remove failing test again 2015-12-29 21:28:27 +01:00
Christian Schabesberger
216063dba8 test if CI failes on failing test 2015-12-29 21:16:18 +01:00
Christian Schabesberger
b647bacd72 add testcase for YoutubeSearchEngine 2015-12-29 21:05:02 +01:00
Christian Schabesberger
4f77937e3e Merge pull request #131 from chschtsch/refactor
refactor localization
2015-12-29 19:14:55 +01:00
chschtsch
48e299b2ac code cleanup 2015-12-29 17:53:24 +03:00
chschtsch
40f00af196 refactor localization 2015-12-29 17:35:51 +03:00
Christian Schabesberger
bd6cc22e63 small hacky error handling refactoring, and add link to c3s 2015-12-28 00:32:38 +01:00
naofum
8760792426 Translated using Weblate (Japanese)
Currently translated at 100.0% (48 of 48 strings)
2015-12-26 12:33:33 +01:00
Christian Schabesberger
870b0bf7aa Merge pull request #127 from 912d/download-directory
Added visible notification after succesful download
2015-12-25 21:27:45 +01:00
Jacek Musiał
afd0bd4318 Added visible notification after succesful downloads
After succesful download, notification will stay in notification bar. I
used "VISIBILITY_VISIBLE_NOTIFY_COMPLETED"  key.
2015-12-25 19:28:09 +01:00
Jacek Musiał
f829ac1d34 Merge remote-tracking branch 'refs/remotes/theScrabi/master' into download-directory 2015-12-25 19:25:13 +01:00
Christian Schabesberger
86a0177855 Merge pull request #126 from Adam77Root/master
Fix view count parsing for large numbers
2015-12-25 16:02:10 +01:00
Adam77Root
718d4fd0bd Fix view count parsing for large numbers 2015-12-25 15:03:11 +01:00
Mladen Pejaković
365137c32b Translated using Weblate (Serbian)
Currently translated at 100.0% (48 of 48 strings)
2015-12-25 00:22:26 +01:00
Christian Schabesberger
e83ca0dfda some improvements for background player 2015-12-25 00:09:35 +01:00
Christian Schabesberger
6a9f6ef651 Merge pull request #123 from 912d/download-directory
Added check if directory exist and try create it
2015-12-23 23:20:42 +01:00
Jacek Musiał
99122ccc03 added check if directory exist and try create it
Also I added new variable `'final File dir`' with value of key
"download_path_preference" or externalStorageDirectory.
Firstly I check if dir exits, then eventually try to create it and next
- download file.
2015-12-23 17:52:01 +01:00
Christian Schabesberger
97923697e1 fixed small writing erros in the README 2015-12-23 14:31:57 +01:00
Greg
68888b15e0 Merge pull request #121 from chschtsch/master
fix sw600dp-land layout problem (#120)
2015-12-23 13:53:42 +03:00
Greg
f48b26067b Update README.md 2015-12-23 11:31:14 +03:00
Greg
4bf2d5837d Update and rename contributing.md to CONTRIBUTING.md 2015-12-23 11:31:11 +03:00
Weblate
4eb2d09c75 Merge remote-tracking branch 'origin/master' 2015-12-22 19:39:49 +01:00
Jack Musial
a146c1c4b6 Translated using Weblate (Polish)
Currently translated at 100.0% (47 of 47 strings)
2015-12-22 19:39:48 +01:00
Sorry Keep Me Anonymous
2f1ea9aa5d Translated using Weblate (Dutch)
Currently translated at 97.8% (46 of 47 strings)
2015-12-22 19:39:48 +01:00
Greg
a90da62deb Merge pull request #122 from rrooij/contributing_guidelines
Add contribution guidelines
2015-12-22 21:39:45 +03:00
Jack Musial
c1c3fbdf26 Translated using Weblate (Polish)
Currently translated at 100.0% (47 of 47 strings)
2015-12-22 18:50:33 +01:00
rrooij
e07a824d82 Add contribution guidelines
Contribution guidelines are a helpful way to inform new potential
contributors about the way in which they can help with the project.

It's also a helpful way to enforce some consistent coding style and
quality among the contributions.
2015-12-22 16:14:56 +01:00
chschtsch
2aff660a5b fix sw600dp-land layout problem (#120) 2015-12-22 15:11:28 +03:00
Weblate
abfcbe6f0e Merge remote-tracking branch 'origin/master' 2015-12-21 22:04:25 +01:00
Matej U
28bf72ed75 Translated using Weblate (Slovenian)
Currently translated at 100.0% (47 of 47 strings)
2015-12-21 22:04:25 +01:00
naofum
21b054d4ca Translated using Weblate (Japanese)
Currently translated at 100.0% (47 of 47 strings)
2015-12-21 22:04:25 +01:00
Greg
34f115b322 remove broken screenshot links 2015-12-22 00:04:22 +03:00
naofum
8b67354076 Translated using Weblate (Japanese)
Currently translated at 100.0% (47 of 47 strings)
2015-12-21 16:20:39 +01:00
M2ck
b62e0a8b40 Translated using Weblate (French)
Currently translated at 100.0% (47 of 47 strings)
2015-12-21 14:20:07 +01:00
Matej U
f46d5376fe Translated using Weblate (Slovenian)
Currently translated at 100.0% (47 of 47 strings)
2015-12-21 13:39:59 +01:00
Matej U
dc3640578f Translated using Weblate (Slovenian)
Currently translated at 100% (0 of 0 strings)

Created new translation.
2015-12-21 13:07:59 +01:00
Sérgio Marques
0a43494de5 Translated using Weblate (Portuguese)
Currently translated at 100.0% (47 of 47 strings)
2015-12-20 22:46:22 +01:00
Sérgio Marques
2544e45d2d Translated using Weblate (Portuguese)
Currently translated at 100% (0 of 0 strings)

Created new translation.
2015-12-20 22:37:30 +01:00
Mladen Pejaković
4a53e9e018 Translated using Weblate (Serbian)
Currently translated at 100.0% (47 of 47 strings)
2015-12-20 22:21:12 +01:00
132 changed files with 6733 additions and 3105 deletions

1
.gitignore vendored
View File

@@ -7,3 +7,4 @@
/app/app.iml
/.idea
/*.iml
gradle.properties

33
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,33 @@
#Contribution
This document contains guidelines on making contributions to NewPipe.
## Programming
* Follow the [Google Style Guidelines](https://google.github.io/styleguide/javaguide.html)
* Make a new feature on a separate branch, not on the master branch
* Make a [pull request](https://github.com/theScrabi/NewPipe/pulls) if you're done with your changes
* When submitting changes, you agree that your code will be GPLv3 licensed
## Commit messages
* The subject line of your commit message shouldn't be longer than 72 characters
* Try to keep each line of your commit message 72 characters to ensure proper
compatibility with all git tools
* [This guide](http://chris.beams.io/posts/git-commit/) goes more in depth on what makes a good commit message
## Translation
* NewPipe can be translated on [weblate](https://hosted.weblate.org/projects/newpipe/strings/)
## Issue reporting
* Search the [existing issues](https://github.com/theScrabi/NewPipe/issues) first to make sure your issue hasn't been reported before
* Check if this issue is already fixed in the repository
* When making bug reports, be sure to tell which version of NewPipe you are using and the steps to reproduce the problem
* Please include a log if you can
## Communication
* For the time being, [Slack](http://invite.chschtsch.ml/) is being used for project communication
* Feel free to post suggestions, changes, ideas etc!

View File

@@ -18,10 +18,6 @@ Project status:
[<img src="screenshots/screenshot_3.png" width=150>](screenshots/screenshot_3.png)
[<img src="screenshots/screenshot_4.png" width=150>](screenshots/screenshot_4.png)
[<img src="screenshots/screenshot_5.png" width=150>](screenshots/screenshot_5.png)
[<img src="screenshots/screenshot_6.png" width=250>](screenshots/screenshot_6.png)
[![Screenshot 1](assets/screenshot_1.png)](assets/screenshot_1.png)
[![Screenshot 2](assets/screenshot_2.png)](assets/screenshot_2.png)
## Description
@@ -39,6 +35,7 @@ NewPipe does not use any Google framework libraries, or the YouTube API. It only
* Open a video in Kodi
* Show Next/Related videos
* Search YouTube in a specific language
* Orbot/Tor support (no streaming yet, experimental)
### Coming Features
@@ -60,7 +57,7 @@ Although NewPipe only supports YouTube at the moment, it's designed to support m
Whether you have ideas, translation, design changes, code cleaning, or real heavy code changes, help is always welcome.
The more is done the better it gets!
Join our [Slack group](http://invite.chschtsch.ml/) if you like to get involved.
If you'd like to get involved, check our [contribution notes](CONTRIBUTING.md).
## License
[![GNU GPLv3 Image](https://www.gnu.org/graphics/gplv3-127x51.png)](http://www.gnu.org/licenses/gpl-3.0.en.html)

View File

@@ -2,14 +2,14 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "org.schabi.newpipe"
minSdkVersion 15
targetSdkVersion 23
versionCode 9
versionName "0.7.0"
versionCode 15
versionName "0.7.6"
}
buildTypes {
release {
@@ -17,13 +17,17 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
@@ -31,8 +35,11 @@ dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'org.jsoup:jsoup:1.8.3'
compile 'org.mozilla:rhino:1.7.7'
compile 'info.guardianproject.netcipher:netcipher:1.2'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.github.nirhart:parallaxscroll:1.0'
}

View File

@@ -0,0 +1,99 @@
package org.schabi.newpipe.services.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.extractor.VideoPreviewInfo;
import org.schabi.newpipe.extractor.SearchEngine;
import org.schabi.newpipe.extractor.services.youtube.YoutubeSearchEngine;
import org.schabi.newpipe.Downloader;
import java.util.ArrayList;
/**
* Created by the-scrabi on 29.12.15.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* YoutubeSearchEngineTest.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class YoutubeSearchEngineTest extends AndroidTestCase {
private SearchEngine.Result result;
private ArrayList<String> suggestionReply;
@Override
public void setUp() throws Exception{
super.setUp();
SearchEngine engine = new YoutubeSearchEngine();
result = engine.search("https://www.youtube.com/results?search_query=bla",
0, "de", new Downloader());
suggestionReply = engine.suggestionList("hello", new Downloader());
}
public void testIfNoErrorOccur() {
assertEquals(result.errorMessage, "");
}
public void testIfListIsNotEmpty() {
assertEquals(result.resultList.size() > 0, true);
}
public void testItemsHaveTitle() {
for(VideoPreviewInfo i : result.resultList) {
assertEquals(i.title.isEmpty(), false);
}
}
public void testItemsHaveUploader() {
for(VideoPreviewInfo i : result.resultList) {
assertEquals(i.uploader.isEmpty(), false);
}
}
public void testItemsHaveRightDuration() {
for(VideoPreviewInfo i : result.resultList) {
assertTrue(i.duration, i.duration.contains(":"));
}
}
public void testItemsHaveRightThumbnail() {
for (VideoPreviewInfo i : result.resultList) {
assertTrue(i.thumbnail_url, i.thumbnail_url.contains("https://"));
}
}
public void testItemsHaveRightVideoUrl() {
for (VideoPreviewInfo i : result.resultList) {
assertTrue(i.webpage_url, i.webpage_url.contains("https://"));
}
}
public void testViewCount() {
for(VideoPreviewInfo i : result.resultList) {
assertTrue(Long.toString(i.view_count), i.view_count != -1);
}
}
public void testIfSuggestionsAreReplied() {
assertEquals(suggestionReply.size() > 0, true);
}
public void testIfSuggestionsAreValid() {
for(String s : suggestionReply) {
assertTrue(s, !s.isEmpty());
}
}
}

View File

@@ -0,0 +1,109 @@
package org.schabi.newpipe.services.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.ParsingException;
import org.schabi.newpipe.extractor.services.youtube.YoutubeStreamExtractor;
import org.schabi.newpipe.extractor.VideoInfo;
import java.io.IOException;
/**
* Created by the-scrabi on 30.12.15.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* YoutubeVideoExtractorDefault.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class YoutubeStreamExtractorDefaultTest extends AndroidTestCase {
private YoutubeStreamExtractor extractor;
public void setUp() throws IOException, ExtractionException {
/* some anonymus video test
extractor = new YoutubeStreamExtractor("https://www.youtube.com/watch?v=FmG385_uUys",
new Downloader()); */
/* some vevo video (suggested to test against) */
extractor = new YoutubeStreamExtractor("https://www.youtube.com/watch?v=YQHsXMglC9A",
new Downloader());
}
public void testGetInvalidTimeStamp() throws ParsingException {
assertTrue(Integer.toString(extractor.getTimeStamp()),
extractor.getTimeStamp() <= 0);
}
public void testGetValidTimeStamp() throws ExtractionException, IOException {
YoutubeStreamExtractor extractor =
new YoutubeStreamExtractor("https://youtu.be/FmG385_uUys?t=174", new Downloader());
assertTrue(Integer.toString(extractor.getTimeStamp()),
extractor.getTimeStamp() == 174);
}
public void testGetTitle() throws ParsingException {
assertTrue(!extractor.getTitle().isEmpty());
}
public void testGetDescription() throws ParsingException {
assertTrue(extractor.getDescription() != null);
}
public void testGetUploader() throws ParsingException {
assertTrue(!extractor.getUploader().isEmpty());
}
public void testGetLength() throws ParsingException {
assertTrue(extractor.getLength() > 0);
}
public void testGetViews() throws ParsingException {
assertTrue(extractor.getLength() > 0);
}
public void testGetUploadDate() throws ParsingException {
assertTrue(extractor.getUploadDate().length() > 0);
}
public void testGetThumbnailUrl() throws ParsingException {
assertTrue(extractor.getThumbnailUrl(),
extractor.getThumbnailUrl().contains("https://"));
}
public void testGetUploaderThumbnailUrl() throws ParsingException {
assertTrue(extractor.getUploaderThumbnailUrl(),
extractor.getUploaderThumbnailUrl().contains("https://"));
}
public void testGetAudioStreams() throws ParsingException {
assertTrue(!extractor.getAudioStreams().isEmpty());
}
public void testGetVideoStreams() throws ParsingException {
for(VideoInfo.VideoStream s : extractor.getVideoStreams()) {
assertTrue(s.url,
s.url.contains("https://"));
assertTrue(s.resolution.length() > 0);
assertTrue(Integer.toString(s.format),
0 <= s.format && s.format <= 4);
}
}
public void testGetDashMpd() throws ParsingException {
assertTrue(extractor.getDashMpdUrl(),
extractor.getDashMpdUrl() != null || !extractor.getDashMpdUrl().isEmpty());
}
}

View File

@@ -0,0 +1,49 @@
package org.schabi.newpipe.services.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.services.youtube.YoutubeStreamExtractor;
import java.io.IOException;
/**
* Created by the-scrabi on 30.12.15.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* YoutubeVideoExtractorGema.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
// This class only works in Germany.
public class YoutubeStreamExtractorGemaTest extends AndroidTestCase {
// Deaktivate this Test Case bevore uploading it githup, otherwise CI will fail.
private static final boolean testActive = false;
public void testGemaError() throws IOException, ExtractionException {
if(testActive) {
try {
new YoutubeStreamExtractor("https://www.youtube.com/watch?v=3O1_3zBUKM8",
new Downloader());
assertTrue("Gema exception not thrown", false);
} catch(YoutubeStreamExtractor.GemaException ge) {
assertTrue(true);
}
}
}
}

View File

@@ -7,6 +7,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:logo="@mipmap/ic_launcher"
@@ -15,7 +16,8 @@
tools:ignore="AllowBackup">
<activity
android:name=".VideoItemListActivity"
android:label="@string/app_name">
android:label="@string/app_name"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -25,47 +27,53 @@
<activity
android:name=".VideoItemDetailActivity"
android:label="@string/title_videoitem_detail"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".VideoItemListActivity" />
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="youtube.com"
android:scheme="http"
android:pathPattern="/?*#*/*watch"/>
<data
android:host="youtube.com"
android:scheme="https"
android:pathPattern="/?*#*/*watch"/>
<data
android:host="www.youtube.com"
android:scheme="http"
android:pathPattern="/?*#*/*watch"/>
<data
android:host="www.youtube.com"
android:scheme="https"
android:pathPattern="/?*#*/*watch"/>
<data
android:host="m.youtube.com"
android:scheme="http"
android:pathPattern="/?*#*/*watch"/>
<data
android:host="m.youtube.com"
android:scheme="https"
android:pathPattern="/?*#*/*watch"/>
<data
android:host="youtu.be"
android:scheme="https"
android:pathPrefix="/"/>
<data
android:host="youtu.be"
android:scheme="http"
android:pathPrefix="/"/>
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="youtube.com" />
<data android:host="m.youtube.com" />
<data android:host="www.youtube.com" />
<data android:pathPrefix="/v/" />
<data android:pathPrefix="/watch" />
<data android:pathPrefix="/attribution_link" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="youtu.be" />
<data android:pathPrefix="/" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="vnd.youtube" />
<data android:scheme="vnd.youtube.launch" />
</intent-filter>
</activity>
<activity android:name=".PlayVideoActivity"
@@ -74,15 +82,26 @@
android:parentActivityName=".VideoItemDetailActivity"
tools:ignore="UnusedAttribute">
</activity>
<!--TODO: make label a translatable string -->
<service
android:name=".BackgroundPlayer"
android:label="NewPipe Background Player"
android:exported="false" >
</service>
android:label="@string/background_player_name"
android:exported="false" />
<activity
android:name=".SettingsActivity"
android:label="@string/title_activity_settings" >
android:label="@string/settings_activity_title" >
</activity>
<activity
android:name=".PanicResponderActivity"
android:launchMode="singleInstance"
android:noHistory="true"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="info.guardianproject.panic.action.TRIGGER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".ExitActivity"
android:theme="@android:style/Theme.NoDisplay" />
</application>
</manifest>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
package org.schabi.newpipe;
/**
* Created by Christian Schabesberger on 24.12.15.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* ActivityCommunicator.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
import android.graphics.Bitmap;
/**
* Singleton:
* Used to send data between certain Activity/Services within the same process.
* This can be considered as hack inside the Android universe. **/
public class ActivityCommunicator {
private static ActivityCommunicator activityCommunicator = null;
public static ActivityCommunicator getCommunicator() {
if(activityCommunicator == null) {
activityCommunicator = new ActivityCommunicator();
}
return activityCommunicator;
}
// Thumbnail send from VideoItemDetailFragment to BackgroundPlayer
public volatile Bitmap backgroundPlayerThumbnail;
}

View File

@@ -0,0 +1,78 @@
package org.schabi.newpipe;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import info.guardianproject.netcipher.NetCipher;
import info.guardianproject.netcipher.proxy.OrbotHelper;
/**
* Copyright (C) Hans-Christoph Steiner 2016 <hans@eds.org>
* App.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class App extends Application {
private static boolean useTor;
@Override
public void onCreate() {
super.onCreate();
// Initialize image loader
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build();
ImageLoader.getInstance().init(config);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if(prefs.getBoolean(getString(R.string.use_tor_key), false)) {
OrbotHelper.requestStartTor(this);
configureTor(true);
} else {
configureTor(false);
}
// DO NOT REMOVE THIS FUNCTION!!!
// Otherwise downloadPathPreference has invalid value.
SettingsActivity.initSettings(this);
}
/**
* Set the proxy settings based on whether Tor should be enabled or not.
*/
static void configureTor(boolean enabled) {
useTor = enabled;
if (useTor) {
NetCipher.useTor();
} else {
NetCipher.setProxy(null);
}
}
static void checkStartTor(Context context) {
if (useTor) {
OrbotHelper.requestStartTor(context);
}
}
static boolean isUsingTor() {
return useTor;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,19 +1,24 @@
package org.schabi.newpipe;
import android.Manifest;
import android.app.Dialog;
import android.app.DownloadManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.DialogFragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.widget.Toast;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Christian Schabesberger on 21.09.15.
@@ -50,42 +55,136 @@ public class DownloadDialog extends DialogFragment {
public Dialog onCreateDialog(Bundle savedInstanceState) {
arguments = getArguments();
super.onCreateDialog(savedInstanceState);
if(ContextCompat.checkSelfPermission(this.getContext(),Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED)
ActivityCompat.requestPermissions(getActivity(),new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},0);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.downloadDialogTitle)
.setItems(R.array.downloadOptions, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Context context = getActivity();
SharedPreferences defaultPreferences = PreferenceManager.getDefaultSharedPreferences(context);
String suffix = "";
String title = arguments.getString(TITLE);
String url = "";
switch(which) {
case 0: // Video
suffix = arguments.getString(FILE_SUFFIX_VIDEO);
url = arguments.getString(VIDEO_URL);
break;
case 1:
suffix = arguments.getString(FILE_SUFFIX_AUDIO);
url = arguments.getString(AUDIO_URL);
break;
default:
Log.d(TAG, "lolz");
}
DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new DownloadManager.Request(
Uri.parse(url));
request.setDestinationUri(Uri.fromFile(new File(
defaultPreferences.getString("download_path_preference", "/storage/emulated/0/NewPipe")
+ "/" + title + suffix)));
try {
dm.enqueue(request);
} catch (Exception e) {
e.printStackTrace();
}
builder.setTitle(R.string.download_dialog_title);
// If no audio stream available
if(arguments.getString(AUDIO_URL) == null) {
builder.setItems(R.array.download_options_no_audio, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Context context = getActivity();
String title = arguments.getString(TITLE);
switch (which) {
case 0: // Video
download(arguments.getString(VIDEO_URL),
title,
arguments.getString(FILE_SUFFIX_VIDEO), context);
break;
default:
Log.d(TAG, "lolz");
}
});
}
});
// If no video stream available
} else if(arguments.getString(VIDEO_URL) == null) {
builder.setItems(R.array.download_options_no_video, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Context context = getActivity();
String title = arguments.getString(TITLE);
switch (which) {
case 0: // Audio
download(arguments.getString(AUDIO_URL),
title,
arguments.getString(FILE_SUFFIX_AUDIO), context);
break;
default:
Log.d(TAG, "lolz");
}
}
});
//if both streams ar available
} else {
builder.setItems(R.array.download_options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Context context = getActivity();
String title = arguments.getString(TITLE);
switch (which) {
case 0: // Video
download(arguments.getString(VIDEO_URL),
title,
arguments.getString(FILE_SUFFIX_VIDEO), context);
break;
case 1:
download(arguments.getString(AUDIO_URL),
title,
arguments.getString(FILE_SUFFIX_AUDIO), context);
break;
default:
Log.d(TAG, "lolz");
}
}
});
}
return builder.create();
}
/**
* #143 #44 #42 #22: make shure that the filename does not contain illegal chars.
* This should fix some of the "cannot download" problems.
* */
private String createFileName(String fName) {
// from http://eng-przemelek.blogspot.de/2009/07/how-to-create-valid-file-name.html
List<String> forbiddenCharsPatterns = new ArrayList<String> ();
forbiddenCharsPatterns.add("[:]+"); // Mac OS, but it looks that also Windows XP
forbiddenCharsPatterns.add("[\\*\"/\\\\\\[\\]\\:\\;\\|\\=\\,]+"); // Windows
forbiddenCharsPatterns.add("[^\\w\\d\\.]+"); // last chance... only latin letters and digits
String nameToTest = fName;
for (String pattern : forbiddenCharsPatterns) {
nameToTest = nameToTest.replaceAll(pattern, "_");
}
return nameToTest;
}
private void download(String url, String title, String fileSuffix, Context context) {
File downloadDir = NewPipeSettings.getDownloadFolder();
if(!downloadDir.exists()) {
//attempt to create directory
boolean mkdir = downloadDir.mkdirs();
if(!mkdir && !downloadDir.isDirectory()) {
String message = context.getString(R.string.err_dir_create,downloadDir.toString());
Log.e(TAG, message);
Toast.makeText(context,message , Toast.LENGTH_LONG).show();
return;
}
String message = context.getString(R.string.info_dir_created,downloadDir.toString());
Log.e(TAG, message);
Toast.makeText(context,message , Toast.LENGTH_LONG).show();
}
File saveFilePath = new File(downloadDir,createFileName(title) + fileSuffix);
long id = 0;
if (App.isUsingTor()) {
// if using Tor, do not use DownloadManager because the proxy cannot be set
FileDownloader.downloadFile(getContext(), url, saveFilePath, title);
} else {
DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new DownloadManager.Request(
Uri.parse(url));
request.setDestinationUri(Uri.fromFile(saveFilePath));
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setTitle(title);
request.setDescription("'" + url +
"' => '" + saveFilePath + "'");
request.allowScanningByMediaScanner();
try {
id = dm.enqueue(request);
} catch (Exception e) {
e.printStackTrace();
}
}
Log.i(TAG,"Started downloading '" + url +
"' => '" + saveFilePath + "' #" + id);
}
}

View File

@@ -3,14 +3,17 @@ package org.schabi.newpipe;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;
import javax.net.ssl.HttpsURLConnection;
import info.guardianproject.netcipher.NetCipher;
/**
* Created by Christian Schabesberger on 14.08.15.
* Created by Christian Schabesberger on 28.01.16.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* Downloader.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
@@ -27,70 +30,61 @@ import java.net.UnknownHostException;
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class Downloader {
private static final String USER_AGENT = "Mozilla/5.0";
public class Downloader implements org.schabi.newpipe.extractor.Downloader {
private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0";
/**Download the text file at the supplied URL as in download(String),
* but set the HTTP header field "Accept-Language" to the supplied string.
* @param siteUrl the URL of the text file to return the contents of
* @param language the language (usually a 2-character code) to set as the preferred language
* @return the contents of the specified text file*/
public static String download(String siteUrl, String language) {
String ret = "";
try {
URL url = new URL(siteUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("Accept-Language", language);
ret = dl(con);
}
catch(Exception e) {
e.printStackTrace();
}
return ret;
public String download(String siteUrl, String language) throws IOException {
URL url = new URL(siteUrl);
//HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
HttpsURLConnection con = NetCipher.getHttpsURLConnection(url);
con.setRequestProperty("Accept-Language", language);
return dl(con);
}
/**Common functionality between download(String url) and download(String url, String language)*/
private static String dl(HttpURLConnection con) throws IOException {
private static String dl(HttpsURLConnection con) throws IOException {
StringBuilder response = new StringBuilder();
BufferedReader in = null;
try {
con.setRequestMethod("GET");
con.setRequestProperty("User-Agent", USER_AGENT);
BufferedReader in = new BufferedReader(
in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
while((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
}
catch(UnknownHostException uhe) {//thrown when there's no internet connection
uhe.printStackTrace();
} catch(UnknownHostException uhe) {//thrown when there's no internet connection
throw new IOException("unknown host or no network", uhe);
//Toast.makeText(getActivity(), uhe.getMessage(), Toast.LENGTH_LONG).show();
} catch(Exception e) {
throw new IOException(e);
} finally {
if(in != null) {
in.close();
}
}
return response.toString();
}
/**Download (via HTTP) the text file located at the supplied URL, and return its contents.
* Primarily intended for downloading web pages.
* @param siteUrl the URL of the text file to download
* @return the contents of the specified text file*/
public static String download(String siteUrl) {
String ret = "";
try {
URL url = new URL(siteUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
ret = dl(con);
}
catch(Exception e) {
e.printStackTrace();
}
return ret;
/**Download (via HTTP) the text file located at the supplied URL, and return its contents.
* Primarily intended for downloading web pages.
* @param siteUrl the URL of the text file to download
* @return the contents of the specified text file*/
public String download(String siteUrl) throws IOException {
URL url = new URL(siteUrl);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
//HttpsURLConnection con = NetCipher.getHttpsURLConnection(url);
return dl(con);
}
}

View File

@@ -0,0 +1,54 @@
package org.schabi.newpipe;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
/**
* Copyright (C) Hans-Christoph Steiner 2016 <hans@eds.org>
* ExitActivity.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class ExitActivity extends Activity {
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= 21) {
finishAndRemoveTask();
} else {
finish();
}
System.exit(0);
}
public static void exitAndRemoveFromRecentApps(Activity activity) {
Intent intent = new Intent(activity, ExitActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
| Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_NO_ANIMATION);
activity.startActivity(intent);
}
}

View File

@@ -0,0 +1,169 @@
package org.schabi.newpipe;
import android.app.NotificationManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;
import javax.net.ssl.HttpsURLConnection;
import info.guardianproject.netcipher.NetCipher;
/**
* Created by Christian Schabesberger on 14.08.15.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* FileDownloader.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class FileDownloader extends AsyncTask<Void, Integer, Void> {
public static final String TAG = "FileDownloader";
private NotificationManager nm;
private NotificationCompat.Builder builder;
private int notifyId = 0x1234;
private int fileSize = 0xffffffff;
private final Context context;
private final String fileURL;
private final File saveFilePath;
private final String title;
private final String debugContext;
public FileDownloader(Context context, String fileURL, File saveFilePath, String title) {
this.context = context;
this.fileURL = fileURL;
this.saveFilePath = saveFilePath;
this.title = title;
this.debugContext = "'" + fileURL +
"' => '" + saveFilePath + "'";
}
/**
* Downloads a file from a URL in the background using an {@link AsyncTask}.
*
* @param fileURL HTTP URL of the file to be downloaded
* @param saveFilePath path of the directory to save the file
* @param title
* @throws IOException
*/
public static void downloadFile(final Context context, final String fileURL, final File saveFilePath, String title) {
new FileDownloader(context, fileURL, saveFilePath, title).execute();
}
/** AsyncTask impl: executed in gui thread */
@Override
protected void onPreExecute() {
super.onPreExecute();
nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Drawable icon = context.getResources().getDrawable(R.mipmap.ic_launcher);
builder = new NotificationCompat.Builder(context)
.setSmallIcon(android.R.drawable.stat_sys_download)
.setLargeIcon(((BitmapDrawable) icon).getBitmap())
.setContentTitle(saveFilePath.getName())
.setContentText(saveFilePath.getAbsolutePath())
.setProgress(fileSize, 0, false);
nm.notify(notifyId, builder.build());
}
/** AsyncTask impl: executed in background thread does the download */
@Override
protected Void doInBackground(Void... voids) {
HttpsURLConnection con = null;
InputStream inputStream = null;
FileOutputStream outputStream = null;
try {
con = NetCipher.getHttpsURLConnection(fileURL);
int responseCode = con.getResponseCode();
// always check HTTP response code first
if (responseCode == HttpURLConnection.HTTP_OK) {
fileSize = con.getContentLength();
inputStream = new BufferedInputStream(con.getInputStream());
outputStream = new FileOutputStream(saveFilePath);
int bufferSize = 8192;
int downloaded = 0;
int bytesRead = -1;
byte[] buffer = new byte[bufferSize];
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
downloaded += bytesRead;
if (downloaded % 50000 < bufferSize) {
publishProgress(downloaded);
}
}
publishProgress(bufferSize);
} else {
Log.i(TAG, "No file to download. Server replied HTTP code: " + responseCode);
}
} catch (IOException e) {
Log.e(TAG, "No file to download. Server replied HTTP code: ", e);
e.printStackTrace();
} finally {
try {
if (outputStream != null) {
outputStream.close();
}
if (inputStream != null) {
inputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
if (con != null) {
con.disconnect();
}
}
return null;
}
@Override
protected void onProgressUpdate(Integer... progress) {
builder.setProgress(fileSize, progress[0], false);
nm.notify(notifyId, builder.build());
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
nm.cancel(notifyId);
}
}

View File

@@ -0,0 +1,93 @@
package org.schabi.newpipe;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.preference.PreferenceManager;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
/**
* Created by chschtsch on 12/29/15.
*
* Copyright (C) Gregory Arkhipov 2015
* Localization.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class Localization {
public static Locale getPreferredLocale(Context context) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
String languageCode = sp.getString(String.valueOf(R.string.search_language_key),
context.getString(R.string.default_language_value));
if(languageCode.length() == 2) {
return new Locale(languageCode);
}
else if(languageCode.contains("_")) {
String country = languageCode
.substring(languageCode.indexOf("_"), languageCode.length());
return new Locale(languageCode.substring(0, 2), country);
}
return Locale.getDefault();
}
public static String localizeViewCount(long viewCount, Context context) {
Locale locale = getPreferredLocale(context);
Resources res = context.getResources();
String viewsString = res.getString(R.string.view_count_text);
NumberFormat nf = NumberFormat.getInstance(locale);
String formattedViewCount = nf.format(viewCount);
return String.format(viewsString, formattedViewCount);
}
public static String localizeNumber(long number, Context context) {
Locale locale = getPreferredLocale(context);
NumberFormat nf = NumberFormat.getInstance(locale);
return nf.format(number);
}
private static String formatDate(String date, Context context) {
Locale locale = getPreferredLocale(context);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date datum = null;
try {
datum = formatter.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
return df.format(datum);
}
public static String localizeDate(String date, Context context) {
Resources res = context.getResources();
String dateString = res.getString(R.string.upload_date_text);
String formattedDate = formatDate(date, context);
return String.format(dateString, formattedDate);
}
}

View File

@@ -0,0 +1,72 @@
/**
* Created by k3b on 07.01.2016.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* NewPipeSettings.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
package org.schabi.newpipe;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.util.Log;
import java.io.File;
/**
* Helper for global settings
*/
public class NewPipeSettings {
public static void initSettings(Context context) {
PreferenceManager.setDefaultValues(context, R.xml.settings, false);
getVideoDownloadFolder(context);
getAudioDownloadFolder(context);
}
public static File getDownloadFolder() {
return getFolder(Environment.DIRECTORY_DOWNLOADS);
}
public static File getVideoDownloadFolder(Context context) {
return getFolder(context, R.string.download_path_key, Environment.DIRECTORY_MOVIES);
}
public static File getAudioDownloadFolder(Context context) {
return getFolder(context, R.string.download_path_audio_key, Environment.DIRECTORY_MUSIC);
}
private static File getFolder(Context context, int keyID, String defaultDirectoryName) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
final String key = context.getString(keyID);
String downloadPath = prefs.getString(key, null);
if ((downloadPath != null) && (!downloadPath.isEmpty())) return new File(downloadPath.trim());
final File folder = getFolder(defaultDirectoryName);
SharedPreferences.Editor spEditor = prefs.edit();
spEditor.putString(key
, new File(folder,"NewPipe").getAbsolutePath());
spEditor.apply();
return folder;
}
@NonNull
private static File getFolder(String defaultDirectoryName) {
return new File(Environment.getExternalStorageDirectory(),defaultDirectoryName);
}
}

View File

@@ -0,0 +1,50 @@
package org.schabi.newpipe;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.media.AudioManager;
/**
* Copyright (C) Hans-Christoph Steiner 2016 <hans@eds.org>
* PanicResponderActivity.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class PanicResponderActivity extends Activity {
public static final String PANIC_TRIGGER_ACTION = "info.guardianproject.panic.action.TRIGGER";
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
if (intent != null && PANIC_TRIGGER_ACTION.equals(intent.getAction())) {
// TODO explicitly clear the search results once they are restored when the app restarts
// or if the app reloads the current video after being killed, that should be cleared also
ExitActivity.exitAndRemoveFromRecentApps(this);
}
if (Build.VERSION.SDK_INT >= 21) {
finishAndRemoveTask();
} else {
finish();
}
}
}

View File

@@ -6,6 +6,7 @@ import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.media.MediaPlayer;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -78,7 +79,7 @@ public class PlayVideoActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play_video);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
isLandscape = checkIfLandscape();
hasSoftKeys = checkIfHasSoftKeys();
@@ -129,7 +130,7 @@ public class PlayVideoActivity extends AppCompatActivity {
public void onPrepared(MediaPlayer mp) {
progressBar.setVisibility(View.GONE);
videoView.seekTo(position);
if (position == 0) {
if (position <= 0) {
videoView.start();
showUi();
} else {
@@ -187,6 +188,18 @@ public class PlayVideoActivity extends AppCompatActivity {
videoView.pause();
}
@Override
public void onResume() {
super.onResume();
App.checkStartTor(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
prefs = getPreferences(Context.MODE_PRIVATE);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
@@ -199,7 +212,7 @@ public class PlayVideoActivity extends AppCompatActivity {
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, videoUrl);
intent.setType("text/plain");
startActivity(Intent.createChooser(intent, getString(R.string.shareDialogTitle)));
startActivity(Intent.createChooser(intent, getString(R.string.share_dialog_title)));
break;
case R.id.menu_item_screen_rotation:
toggleOrientation();

View File

@@ -1,10 +1,16 @@
package org.schabi.newpipe;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Environment;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
@@ -17,6 +23,8 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import info.guardianproject.netcipher.proxy.OrbotHelper;
/**
* Created by Christian Schabesberger on 31.08.15.
*
@@ -37,8 +45,9 @@ import android.view.ViewGroup;
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class SettingsActivity extends PreferenceActivity {
public class SettingsActivity extends PreferenceActivity {
private static final int REQUEST_INSTALL_ORBOT = 0x1234;
private AppCompatDelegate mDelegate = null;
@Override
@@ -55,12 +64,108 @@ public class SettingsActivity extends PreferenceActivity {
}
public static class SettingsFragment extends PreferenceFragment {
public static class SettingsFragment extends PreferenceFragment{
SharedPreferences.OnSharedPreferenceChangeListener prefListener;
// get keys
String DEFAULT_RESOLUTION_PREFERENCE;
String DEFAULT_AUDIO_FORMAT_PREFERENCE;
String SEARCH_LANGUAGE_PREFERENCE;
String DOWNLOAD_PATH_PREFERENCE;
String DOWNLOAD_PATH_AUDIO_PREFERENCE;
String USE_TOR_KEY;
private ListPreference defaultResolutionPreference;
private ListPreference defaultAudioFormatPreference;
private ListPreference searchLanguagePreference;
private EditTextPreference downloadPathPreference;
private EditTextPreference downloadPathAudioPreference;
private CheckBoxPreference useTorCheckBox;
private SharedPreferences defaultPreferences;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings_screen);
addPreferencesFromResource(R.xml.settings);
final Activity activity = getActivity();
defaultPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
// get keys
DEFAULT_RESOLUTION_PREFERENCE =getString(R.string.default_resolution_key);
DEFAULT_AUDIO_FORMAT_PREFERENCE =getString(R.string.default_audio_format_key);
SEARCH_LANGUAGE_PREFERENCE =getString(R.string.search_language_key);
DOWNLOAD_PATH_PREFERENCE = getString(R.string.download_path_key);
DOWNLOAD_PATH_AUDIO_PREFERENCE = getString(R.string.download_path_audio_key);
USE_TOR_KEY = getString(R.string.use_tor_key);
// get pref objects
defaultResolutionPreference =
(ListPreference) findPreference(DEFAULT_RESOLUTION_PREFERENCE);
defaultAudioFormatPreference =
(ListPreference) findPreference(DEFAULT_AUDIO_FORMAT_PREFERENCE);
searchLanguagePreference =
(ListPreference) findPreference(SEARCH_LANGUAGE_PREFERENCE);
downloadPathPreference =
(EditTextPreference) findPreference(DOWNLOAD_PATH_PREFERENCE);
downloadPathAudioPreference =
(EditTextPreference) findPreference(DOWNLOAD_PATH_AUDIO_PREFERENCE);
useTorCheckBox = (CheckBoxPreference) findPreference(USE_TOR_KEY);
prefListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
Activity a = getActivity();
updateSummary();
if (defaultPreferences.getBoolean(USE_TOR_KEY, false)) {
if (OrbotHelper.isOrbotInstalled(a)) {
App.configureTor(true);
OrbotHelper.requestStartTor(a);
} else {
Intent intent = OrbotHelper.getOrbotInstallIntent(a);
a.startActivityForResult(intent, REQUEST_INSTALL_ORBOT);
}
} else {
App.configureTor(false);
}
}
};
defaultPreferences.registerOnSharedPreferenceChangeListener(prefListener);
updateSummary();
}
// This is used to show the status of some preference in the description
private void updateSummary() {
defaultResolutionPreference.setSummary(
defaultPreferences.getString(DEFAULT_RESOLUTION_PREFERENCE,
getString(R.string.default_resolution_value)));
defaultAudioFormatPreference.setSummary(
defaultPreferences.getString(DEFAULT_AUDIO_FORMAT_PREFERENCE,
getString(R.string.default_audio_format_value)));
searchLanguagePreference.setSummary(
defaultPreferences.getString(SEARCH_LANGUAGE_PREFERENCE,
getString(R.string.default_language_value)));
downloadPathPreference.setSummary(
defaultPreferences.getString(DOWNLOAD_PATH_PREFERENCE,
getString(R.string.download_path_summary)));
downloadPathAudioPreference.setSummary(
defaultPreferences.getString(DOWNLOAD_PATH_AUDIO_PREFERENCE,
getString(R.string.download_path_audio_summary)));
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// try to start tor regardless of resultCode since clicking back after
// installing the app does not necessarily return RESULT_OK
App.configureTor(requestCode == REQUEST_INSTALL_ORBOT
&& OrbotHelper.requestStartTor(this));
}
@Override
@@ -150,15 +255,6 @@ public class SettingsActivity extends PreferenceActivity {
}
public static void initSettings(Context context) {
PreferenceManager.setDefaultValues(context, R.xml.settings_screen, false);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
if(sp.getString(context.getString(R.string.downloadPathPreference), "").isEmpty()){
SharedPreferences.Editor spEditor = sp.edit();
String newPipeDownloadStorage =
Environment.getExternalStorageDirectory().getAbsolutePath() + "/NewPipe";
spEditor.putString(context.getString(R.string.downloadPathPreference)
, newPipeDownloadStorage);
spEditor.apply();
}
NewPipeSettings.initSettings(context);
}
}

View File

@@ -1,101 +0,0 @@
package org.schabi.newpipe;
import org.schabi.newpipe.services.AbstractVideoInfo;
import java.util.List;
/**
* Created by Christian Schabesberger on 26.08.15.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* VideoInfo.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
/**Info object for opened videos, ie the video ready to play.*/
@SuppressWarnings("ALL")
public class VideoInfo extends AbstractVideoInfo {
public String uploader_thumbnail_url = "";
public String description = "";
public VideoStream[] videoStreams = null;
public AudioStream[] audioStreams = null;
public int videoAvailableStatus = VIDEO_AVAILABLE;
public int duration = -1;
/*YouTube-specific fields
todo: move these to a subclass*/
public int age_limit = 0;
public int like_count = -1;
public int dislike_count = -1;
public String average_rating = "";
public VideoPreviewInfo nextVideo = null;
public List<VideoPreviewInfo> relatedVideos = null;
public int startPosition = -1;//in seconds. some metadata is not passed using a VideoInfo object!
public static final int VIDEO_AVAILABLE = 0x00;
public static final int VIDEO_UNAVAILABLE = 0x01;
public static final int VIDEO_UNAVAILABLE_GEMA = 0x02;//German DRM organisation
public VideoInfo() {}
/**Creates a new VideoInfo object from an existing AbstractVideoInfo.
* All the shared properties are copied to the new VideoInfo.*/
@SuppressWarnings("WeakerAccess")
public VideoInfo(AbstractVideoInfo avi) {
this.id = avi.id;
this.title = avi.title;
this.uploader = avi.uploader;
this.thumbnail_url = avi.thumbnail_url;
this.thumbnail = avi.thumbnail;
this.webpage_url = avi.webpage_url;
this.upload_date = avi.upload_date;
this.upload_date = avi.upload_date;
this.view_count = avi.view_count;
//todo: better than this
if(avi instanceof VideoPreviewInfo) {//shitty String to convert code
String dur = ((VideoPreviewInfo)avi).duration;
int minutes = Integer.parseInt(dur.substring(0, dur.indexOf(":")));
int seconds = Integer.parseInt(dur.substring(dur.indexOf(":")+1, dur.length()));
this.duration = (minutes*60)+seconds;
}
}
public static class VideoStream {
public String url = ""; //url of the stream
public int format = -1;
public String resolution = "";
public VideoStream(String url, int format, String res) {
this.url = url; this.format = format; resolution = res;
}
}
@SuppressWarnings("unused")
public static class AudioStream {
public String url = "";
public int format = -1;
public int bandwidth = -1;
public int samplingRate = -1;
public AudioStream(String url, int format, int bandwidth, int samplingRate) {
this.url = url; this.format = format;
this.bandwidth = bandwidth; this.samplingRate = samplingRate;
}
}
}

View File

@@ -1,11 +1,16 @@
package org.schabi.newpipe;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import org.schabi.newpipe.extractor.VideoPreviewInfo;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
/**
* Created by Christian Schabesberger on 24.10.15.
*
@@ -28,12 +33,14 @@ import android.widget.TextView;
class VideoInfoItemViewCreator {
private final LayoutInflater inflater;
private ImageLoader imageLoader = ImageLoader.getInstance();
private DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder().cacheInMemory(true).build();
public VideoInfoItemViewCreator(LayoutInflater inflater) {
this.inflater = inflater;
}
public View getViewByVideoInfoItem(View convertView, ViewGroup parent, VideoPreviewInfo info) {
public View getViewFromVideoInfoItem(View convertView, ViewGroup parent, VideoPreviewInfo info, Context context) {
ViewHolder holder;
if(convertView == null) {
convertView = inflater.inflate(R.layout.video_item, parent, false);
@@ -43,6 +50,7 @@ class VideoInfoItemViewCreator {
holder.itemUploaderView = (TextView) convertView.findViewById(R.id.itemUploaderView);
holder.itemDurationView = (TextView) convertView.findViewById(R.id.itemDurationView);
holder.itemUploadDateView = (TextView) convertView.findViewById(R.id.itemUploadDateView);
holder.itemViewCountView = (TextView) convertView.findViewById(R.id.itemViewCountView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
@@ -56,19 +64,31 @@ class VideoInfoItemViewCreator {
holder.itemVideoTitleView.setText(info.title);
holder.itemUploaderView.setText(info.uploader);
holder.itemDurationView.setText(info.duration);
holder.itemViewCountView.setText(shortViewCount(info.view_count));
if(!info.upload_date.isEmpty()) {
holder.itemUploadDateView.setText(info.upload_date);
} else {
//tweak if necessary: This is a hack to prevent having white space in the layout :P
holder.itemUploadDateView.setText(String.format("%d", info.view_count));
holder.itemUploadDateView.setText(info.upload_date+" • ");
}
imageLoader.displayImage(info.thumbnail_url, holder.itemThumbnailView, displayImageOptions);
return convertView;
}
private class ViewHolder {
public ImageView itemThumbnailView;
public TextView itemVideoTitleView, itemUploaderView, itemDurationView, itemUploadDateView;
public TextView itemVideoTitleView, itemUploaderView, itemDurationView, itemUploadDateView, itemViewCountView;
}
private String shortViewCount(Long view_count){
if(view_count >= 1000000000){
return Long.toString(view_count/1000000000)+"B views";
}else if(view_count>=1000000){
return Long.toString(view_count/1000000)+"M views";
}else if(view_count>=1000){
return Long.toString(view_count/1000)+"K views";
}else {
return Long.toString(view_count)+" views";
}
}
}

View File

@@ -1,6 +1,7 @@
package org.schabi.newpipe;
import android.content.Intent;
import android.media.AudioManager;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.NavUtils;
@@ -10,8 +11,8 @@ import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import org.schabi.newpipe.services.ServiceList;
import org.schabi.newpipe.services.StreamingService;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamingService;
/**
@@ -44,7 +45,7 @@ public class VideoItemDetailActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_videoitem_detail);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
// Show the Up button in the action bar.
try {
//noinspection ConstantConditions
@@ -70,9 +71,9 @@ public class VideoItemDetailActivity extends AppCompatActivity {
if (getIntent().getData() != null) {
videoUrl = getIntent().getData().toString();
StreamingService[] serviceList = ServiceList.getServices();
//VideoExtractor videoExtractor = null;
//StreamExtractor videoExtractor = null;
for (int i = 0; i < serviceList.length; i++) {
if (serviceList[i].acceptUrl(videoUrl)) {
if (serviceList[i].getUrlIdHandler().acceptUrl(videoUrl)) {
arguments.putInt(VideoItemDetailFragment.STREAMING_SERVICE, i);
currentStreamingService = i;
//videoExtractor = ServiceList.getService(i).getExtractorInstance();
@@ -80,7 +81,7 @@ public class VideoItemDetailActivity extends AppCompatActivity {
}
}
if(currentStreamingService == -1) {
Toast.makeText(this, R.string.urlNotSupportedText, Toast.LENGTH_LONG)
Toast.makeText(this, R.string.url_not_supported_toast, Toast.LENGTH_LONG)
.show();
}
//arguments.putString(VideoItemDetailFragment.VIDEO_URL,
@@ -89,7 +90,7 @@ public class VideoItemDetailActivity extends AppCompatActivity {
arguments.putBoolean(VideoItemDetailFragment.AUTO_PLAY,
PreferenceManager.getDefaultSharedPreferences(this)
.getBoolean(getString(R.string.autoPlayThroughIntent), false));
.getBoolean(getString(R.string.autoplay_through_intent_key), false));
} else {
videoUrl = getIntent().getStringExtra(VideoItemDetailFragment.VIDEO_URL);
currentStreamingService = getIntent().getIntExtra(VideoItemDetailFragment.STREAMING_SERVICE, -1);
@@ -113,6 +114,12 @@ public class VideoItemDetailActivity extends AppCompatActivity {
.commit();
}
@Override
public void onResume() {
super.onResume();
App.checkStartTor(this);
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putString(VideoItemDetailFragment.VIDEO_URL, videoUrl);

View File

@@ -3,6 +3,7 @@ package org.schabi.newpipe;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
@@ -15,7 +16,8 @@ import android.view.inputmethod.InputMethodManager;
import java.util.ArrayList;
import org.schabi.newpipe.services.ServiceList;
import org.schabi.newpipe.extractor.VideoPreviewInfo;
import org.schabi.newpipe.extractor.ServiceList;
/**
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
@@ -111,7 +113,7 @@ public class VideoItemListActivity extends AppCompatActivity
//------ todo: remove this line when multiservice support is implemented ------
currentStreamingServiceId = ServiceList.getIdOfService("Youtube");
//-----------------------------------------------------------------------------
//to solve issue 38
listFragment = (VideoItemListFragment) getSupportFragmentManager()
.findFragmentById(R.id.videoitem_list);
listFragment.setStreamingService(ServiceList.getService(currentStreamingServiceId));
@@ -171,7 +173,13 @@ public class VideoItemListActivity extends AppCompatActivity
}
}
SettingsActivity.initSettings(this);
PreferenceManager.setDefaultValues(this, R.xml.settings, false);
}
@Override
public void onResume() {
super.onResume();
App.checkStartTor(this);
}
/**
@@ -190,7 +198,7 @@ public class VideoItemListActivity extends AppCompatActivity
// adding or replacing the detail fragment using a
// fragment transaction.
Bundle arguments = new Bundle();
arguments.putString(VideoItemDetailFragment.ARG_ITEM_ID, id);
//arguments.putString(VideoItemDetailFragment.ARG_ITEM_ID, id);
arguments.putString(VideoItemDetailFragment.VIDEO_URL, webpage_url);
arguments.putInt(VideoItemDetailFragment.STREAMING_SERVICE, currentStreamingServiceId);
videoFragment = new VideoItemDetailFragment();
@@ -209,7 +217,7 @@ public class VideoItemListActivity extends AppCompatActivity
// In single-pane mode, simply start the detail activity
// for the selected item ID.
Intent detailIntent = new Intent(this, VideoItemDetailActivity.class);
detailIntent.putExtra(VideoItemDetailFragment.ARG_ITEM_ID, id);
//detailIntent.putExtra(VideoItemDetailFragment.ARG_ITEM_ID, id);
detailIntent.putExtra(VideoItemDetailFragment.VIDEO_URL, webpage_url);
detailIntent.putExtra(VideoItemDetailFragment.STREAMING_SERVICE, currentStreamingServiceId);
startActivity(detailIntent);

View File

@@ -2,8 +2,6 @@ package org.schabi.newpipe;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
@@ -15,12 +13,14 @@ import android.widget.AbsListView;
import android.widget.ListView;
import android.widget.Toast;
import java.net.URL;
import java.io.IOException;
import java.util.List;
import java.util.Vector;
import org.schabi.newpipe.services.SearchEngine;
import org.schabi.newpipe.services.StreamingService;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.ParsingException;
import org.schabi.newpipe.extractor.VideoPreviewInfo;
import org.schabi.newpipe.extractor.SearchEngine;
import org.schabi.newpipe.extractor.StreamingService;
/**
@@ -58,14 +58,15 @@ public class VideoItemListFragment extends ListFragment {
private Thread searchThread = null;
private SearchRunnable searchRunnable = null;
private Thread loadThumbsThread = null;
private LoadThumbsRunnable loadThumbsRunnable = null;
// used to track down if results posted by threads ar still valid
private int currentRequestId = -1;
private ListView list;
private View footer;
// used to suppress request for loading a new page while another page is already loading.
private boolean loadingNextPage = true;
private class ResultRunnable implements Runnable {
private final SearchEngine.Result result;
private final int requestId;
@@ -76,6 +77,9 @@ public class VideoItemListFragment extends ListFragment {
@Override
public void run() {
updateListOnResult(result, requestId);
if (android.os.Build.VERSION.SDK_INT >= 19) {
getListView().removeFooterView(footer);
}
}
}
@@ -84,7 +88,7 @@ public class VideoItemListFragment extends ListFragment {
private final String query;
private final int page;
final Handler h = new Handler();
private volatile boolean run = true;
private volatile boolean runs = true;
private final int requestId;
public SearchRunnable(SearchEngine engine, String query, int page, int requestId) {
this.engine = engine;
@@ -93,91 +97,31 @@ public class VideoItemListFragment extends ListFragment {
this.requestId = requestId;
}
void terminate() {
run = false;
runs = false;
}
@Override
public void run() {
try {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
String searchLanguageKey = getContext().getString(R.string.searchLanguage);
String searchLanguage = sp.getString(searchLanguageKey, "en");
SearchEngine.Result result = engine.search(query, page, searchLanguage);
Log.i(TAG, "language code passed:\""+searchLanguage+"\"");
if(run) {
String searchLanguageKey = getContext().getString(R.string.search_language_key);
String searchLanguage = sp.getString(searchLanguageKey,
getString(R.string.default_language_value));
SearchEngine.Result result = engine.search(query, page, searchLanguage,
new Downloader());
//Log.i(TAG, "language code passed:\""+searchLanguage+"\"");
if(runs) {
h.post(new ResultRunnable(result, requestId));
}
} catch(Exception e) {
} catch(IOException e) {
postNewErrorToast(h, R.string.network_error);
e.printStackTrace();
} catch(ExtractionException ce) {
postNewErrorToast(h, R.string.parsing_error);
ce.printStackTrace();
} catch(Exception e) {
postNewErrorToast(h, R.string.general_error);
e.printStackTrace();
h.post(new Runnable() {
@Override
public void run() {
Toast.makeText(getActivity(), "Network Error", Toast.LENGTH_SHORT).show();
}
});
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (android.os.Build.VERSION.SDK_INT >= 19) {
getListView().removeFooterView(footer);
}
}
});
}
}
private class LoadThumbsRunnable implements Runnable {
private final Vector<String> thumbnailUrlList = new Vector<>();
private final Vector<Boolean> downloadedList;
final Handler h = new Handler();
private volatile boolean run = true;
private final int requestId;
public LoadThumbsRunnable(Vector<VideoPreviewInfo> videoList,
Vector<Boolean> downloadedList, int requestId) {
for(VideoPreviewInfo item : videoList) {
thumbnailUrlList.add(item.thumbnail_url);
}
this.downloadedList = downloadedList;
this.requestId = requestId;
}
public void terminate() {
run = false;
}
public boolean isRunning() {
return run;
}
@Override
public void run() {
for(int i = 0; i < thumbnailUrlList.size() && run; i++) {
if(!downloadedList.get(i)) {
Bitmap thumbnail;
try {
thumbnail = BitmapFactory.decodeStream(
new URL(thumbnailUrlList.get(i)).openConnection().getInputStream());
h.post(new SetThumbnailRunnable(i, thumbnail, requestId));
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
private class SetThumbnailRunnable implements Runnable {
private final int index;
private final Bitmap thumbnail;
private final int requestId;
public SetThumbnailRunnable(int index, Bitmap thumbnail, int requestId) {
this.index = index;
this.thumbnail = thumbnail;
this.requestId = requestId;
}
@Override
public void run() {
if(requestId == currentRequestId) {
videoListAdapter.updateDownloadedThumbnailList(index);
videoListAdapter.setThumbnail(index, thumbnail);
}
}
}
@@ -203,8 +147,9 @@ public class VideoItemListFragment extends ListFragment {
}
private void nextPage() {
loadingNextPage = true;
lastPage++;
Log.d(TAG, getString(R.string.searchPage) + Integer.toString(lastPage));
Log.d(TAG, getString(R.string.search_page) + Integer.toString(lastPage));
startSearch(query, lastPage);
}
@@ -228,7 +173,7 @@ public class VideoItemListFragment extends ListFragment {
Toast.makeText(getActivity(), result.errorMessage, Toast.LENGTH_LONG).show();
} else {
if (!result.suggestion.isEmpty()) {
Toast.makeText(getActivity(), getString(R.string.didYouMean) + result.suggestion + " ?",
Toast.makeText(getActivity(), getString(R.string.did_you_mean) + result.suggestion + " ?",
Toast.LENGTH_LONG).show();
}
updateList(result.resultList);
@@ -240,26 +185,16 @@ public class VideoItemListFragment extends ListFragment {
try {
videoListAdapter.addVideoList(list);
terminateThreads();
loadThumbsRunnable = new LoadThumbsRunnable(videoListAdapter.getVideoList(),
videoListAdapter.getDownloadedThumbnailList(), currentRequestId);
loadThumbsThread = new Thread(loadThumbsRunnable);
loadThumbsThread.start();
} catch(java.lang.IllegalStateException e) {
Log.w(TAG, "Trying to set value while activity doesn't exist anymore.");
} catch(Exception e) {
e.printStackTrace();
} finally {
loadingNextPage = false;
}
}
private void terminateThreads() {
if(loadThumbsRunnable != null && loadThumbsRunnable.isRunning()) {
loadThumbsRunnable.terminate();
try {
loadThumbsThread.join();
} catch(Exception e) {
e.printStackTrace();
}
}
if(searchThread != null) {
searchRunnable.terminate();
// No need to join, since we don't really terminate the thread. We just demand
@@ -297,7 +232,8 @@ public class VideoItemListFragment extends ListFragment {
super.onViewCreated(view, savedInstanceState);
list = getListView();
videoListAdapter = new VideoListAdapter(getActivity(), this);
footer = ((LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.paginate_footer, null, false);
footer = ((LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE))
.inflate(R.layout.paginate_footer, null, false);
setListAdapter(videoListAdapter);
@@ -318,13 +254,15 @@ public class VideoItemListFragment extends ListFragment {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if (mode != PRESENT_VIDEOS_MODE
&& list.getChildAt(0) != null
&& list.getLastVisiblePosition() == list.getAdapter().getCount() - 1
&& list.getChildAt(list.getChildCount() - 1).getBottom() <= list.getHeight()) {
long time = System.currentTimeMillis();
if ((time - lastScrollDate) > 200) {
if ((time - lastScrollDate) > 200
&& !loadingNextPage) {
lastScrollDate = time;
getListView().addFooterView(footer);
nextPage();
@@ -376,4 +314,14 @@ public class VideoItemListFragment extends ListFragment {
mActivatedPosition = position;
}
private void postNewErrorToast(Handler h, final int stringResource) {
h.post(new Runnable() {
@Override
public void run() {
setListShown(true);
Toast.makeText(getActivity(), getString(stringResource),
Toast.LENGTH_SHORT).show();
}
});
}
}

View File

@@ -1,7 +1,6 @@
package org.schabi.newpipe;
import android.content.Context;
import android.graphics.Bitmap;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
@@ -9,6 +8,8 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import org.schabi.newpipe.extractor.VideoPreviewInfo;
import java.util.List;
import java.util.Vector;
@@ -36,7 +37,6 @@ class VideoListAdapter extends BaseAdapter {
private final Context context;
private final VideoInfoItemViewCreator viewCreator;
private Vector<VideoPreviewInfo> videoList = new Vector<>();
private Vector<Boolean> downloadedThumbnailList = new Vector<>();
private final ListView listView;
public VideoListAdapter(Context context, VideoItemListFragment videoListFragment) {
@@ -49,15 +49,11 @@ class VideoListAdapter extends BaseAdapter {
public void addVideoList(List<VideoPreviewInfo> videos) {
videoList.addAll(videos);
for(int i = 0; i < videos.size(); i++) {
downloadedThumbnailList.add(false);
}
notifyDataSetChanged();
}
public void clearVideoList() {
videoList = new Vector<>();
downloadedThumbnailList = new Vector<>();
notifyDataSetChanged();
}
@@ -65,20 +61,6 @@ class VideoListAdapter extends BaseAdapter {
return videoList;
}
public void updateDownloadedThumbnailList(int index) {
downloadedThumbnailList.set(index, true);
}
public Vector<Boolean> getDownloadedThumbnailList() {
return downloadedThumbnailList;
}
public void setThumbnail(int index, Bitmap thumbnail) {
videoList.get(index).thumbnail = thumbnail;
downloadedThumbnailList.set(index, true);
notifyDataSetChanged();
}
@Override
public int getCount() {
return videoList.size();
@@ -96,10 +78,10 @@ class VideoListAdapter extends BaseAdapter {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = viewCreator.getViewByVideoInfoItem(convertView, parent, videoList.get(position));
convertView = viewCreator.getViewFromVideoInfoItem(convertView, parent, videoList.get(position), context);
if(listView.isItemChecked(position)) {
convertView.setBackgroundColor(ContextCompat.getColor(context,R.color.primaryColorYoutube));
convertView.setBackgroundColor(ContextCompat.getColor(context,R.color.light_youtube_primary_color));
} else {
convertView.setBackgroundColor(0);
}

View File

@@ -0,0 +1,33 @@
package org.schabi.newpipe.extractor;
import android.graphics.Bitmap;
/**
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* AbstractVideoInfo.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
/**Common properties between VideoInfo and VideoPreviewInfo.*/
public abstract class AbstractVideoInfo {
public String id = "";
public String title = "";
public String uploader = "";
public String thumbnail_url = "";
public Bitmap thumbnail = null;
public String webpage_url = "";
public String upload_date = "";
public long view_count = -1;
}

View File

@@ -0,0 +1,105 @@
package org.schabi.newpipe.extractor;
import android.util.Xml;
import org.xmlpull.v1.XmlPullParser;
import java.io.IOException;
import java.io.StringReader;
import java.util.List;
import java.util.Vector;
/**
* Created by Christian Schabesberger on 02.02.16.
*
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* DashMpdParser.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class DashMpdParser {
static class DashMpdParsingException extends ParsingException {
DashMpdParsingException(String message, Exception e) {
super(message, e);
}
}
public static List<VideoInfo.AudioStream> getAudioStreams(String dashManifestUrl,
Downloader downloader)
throws DashMpdParsingException {
String dashDoc;
try {
dashDoc = downloader.download(dashManifestUrl);
} catch(IOException ioe) {
throw new DashMpdParsingException("Could not get dash mpd: " + dashManifestUrl, ioe);
}
Vector<VideoInfo.AudioStream> audioStreams = new Vector<>();
try {
XmlPullParser parser = Xml.newPullParser();
parser.setInput(new StringReader(dashDoc));
String tagName = "";
String currentMimeType = "";
int currentBandwidth = -1;
int currentSamplingRate = -1;
boolean currentTagIsBaseUrl = false;
for(int eventType = parser.getEventType();
eventType != XmlPullParser.END_DOCUMENT;
eventType = parser.next() ) {
switch(eventType) {
case XmlPullParser.START_TAG:
tagName = parser.getName();
if(tagName.equals("AdaptationSet")) {
currentMimeType = parser.getAttributeValue(XmlPullParser.NO_NAMESPACE, "mimeType");
} else if(tagName.equals("Representation") && currentMimeType.contains("audio")) {
currentBandwidth = Integer.parseInt(
parser.getAttributeValue(XmlPullParser.NO_NAMESPACE, "bandwidth"));
currentSamplingRate = Integer.parseInt(
parser.getAttributeValue(XmlPullParser.NO_NAMESPACE, "audioSamplingRate"));
} else if(tagName.equals("BaseURL")) {
currentTagIsBaseUrl = true;
}
break;
case XmlPullParser.TEXT:
// actual stream tag
if(currentTagIsBaseUrl &&
(currentMimeType.contains("audio"))) {
int format = -1;
if(currentMimeType.equals(MediaFormat.WEBMA.mimeType)) {
format = MediaFormat.WEBMA.id;
} else if(currentMimeType.equals(MediaFormat.M4A.mimeType)) {
format = MediaFormat.M4A.id;
}
audioStreams.add(new VideoInfo.AudioStream(parser.getText(),
format, currentBandwidth, currentSamplingRate));
}
break;
case XmlPullParser.END_TAG:
if(tagName.equals("AdaptationSet")) {
currentMimeType = "";
} else if(tagName.equals("BaseURL")) {
currentTagIsBaseUrl = false;
}
break;
}
}
} catch(Exception e) {
throw new DashMpdParsingException("Could not parse Dash mpd", e);
}
return audioStreams;
}
}

View File

@@ -0,0 +1,41 @@
package org.schabi.newpipe.extractor;
import java.io.IOException;
/**
* Created by Christian Schabesberger on 28.01.16.
*
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* Downloader.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public interface Downloader {
/**Download the text file at the supplied URL as in download(String),
* but set the HTTP header field "Accept-Language" to the supplied string.
* @param siteUrl the URL of the text file to return the contents of
* @param language the language (usually a 2-character code) to set as the preferred language
* @return the contents of the specified text file
* @throws IOException*/
String download(String siteUrl, String language) throws IOException;
/**Download (via HTTP) the text file located at the supplied URL, and return its contents.
* Primarily intended for downloading web pages.
* @param siteUrl the URL of the text file to download
* @return the contents of the specified text file
* @throws IOException*/
String download(String siteUrl) throws IOException;
}

View File

@@ -0,0 +1,37 @@
package org.schabi.newpipe.extractor;
/**
* Created by Christian Schabesberger on 30.01.16.
*
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* ExtractionException.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class ExtractionException extends Exception {
public ExtractionException() {}
public ExtractionException(String message) {
super(message);
}
public ExtractionException(Throwable cause) {
super(cause);
}
public ExtractionException(String message, Throwable cause) {
super(message, cause);
}
}

Some files were not shown because too many files have changed in this diff Show More