Browse code

rewrite code is shorter now

Stefan Höhn authored on11/06/2019 13:24:41 • GitHub committed on11/06/2019 13:24:41
Showing1 changed files

... ...
@@ -6,7 +6,8 @@
6 6
 # "youtube-dl -U" 
7 7
 ## or 
8 8
 # pip install --upgrade youtube-dl
9
-# sleep 3
9
+sleep 1
10
+#zaehl=0
10 11
 
11 12
 ## Variables ##
12 13
 ## ----------important-------------
... ...
@@ -19,21 +20,28 @@ favdir="bestof"
19 20
 ffon=0; pgrep firefox && ffon=1
20 21
 ## Firefox default Profil
21 22
 ## only if you not using the default FF-profile, this line must be edited ## 
22
-ffprofile=$(grep 'Path=' ~/.mozilla/firefox/profiles.ini | sed s/^Path=//)
23
+# ffprofile=$(grep 'Path=' ~/.mozilla/firefox/profiles.ini | sed s/^Path=//)
23 24
 ## Date= yesterday ##
24 25
 datum=$(date -d "1 day ago" '+%Y%m%d')
25 26
 ## Max. videos download in each playlist ##
26 27
 perday=4
27 28
 ## if aria2 downloader is installed and you want to use it, change from 0 to 1  ##
28
-aria=0
29
+aria2=''
29 30
 ## load from "database" or "array". database == firefox SQLITE 
30 31
 loadfrom=database
31 32
 ## firefox database
32 33
 sqltdata=places.sqlite
33 34
 
34 35
 ## Start ##
36
+cd ~/.mozilla/firefox/*default* || exit
37
+
38
+if [ $ffon == 1 ] && [ $loadfrom == database ]
39
+then
40
+cp $sqltdata places2.sqlite
41
+sqltdata=places2.sqlite
42
+fi
43
+## only edit dbarray test-content if you want to use it
35 44
 
36
-##  Use array, edit dbarray for your needs else this is ignored. ##
37 45
 if [ $loadfrom == array ]
38 46
 then
39 47
  dbarray=(
... ...
@@ -41,33 +49,31 @@ then
41 49
  "https://www.youtube.com/user/BibisBeautyPalace/videos?sort=dd&shelf_id=1&view=0"
42 50
  "https://www.youtube.com/channel/UC53bIpnef1pwAx69ERmmOLA"
43 51
 )
44
- ##-----carefully edit below this line ! ---------
45
- else
46
- # cd ~/.mozilla/firefox/*default* || exit
47
- cd "$HOME/.mozilla/firefox/$ffprofile" || exit
48
- ## If Firefox is running, db is locked. need a copy ##
49
- if [ $ffon == 1 ] && [ $loadfrom == database ]
50
-  then
51
-  cp $sqltdata places2.sqlite
52
-  sqltdata=places2.sqlite
53
- fi
52
+ ##
53
+##--------------------Do not edit below this line ! -----------------------
54
+##
55
+ 
56
+else
54 57
  ## This line puts FF bookmarks from sqlite3 to an array ##
55
- readarray -t dbarray < "$(sqlite3 -list $sqltdata 'select url from moz_places where id in (select fk from moz_bookmarks where parent in ( select "id" from moz_bookmarks where title == "'$favdir'"))'; )"
58
+
59
+ dbarray=( $(sqlite3 -list $sqltdata 'select url from moz_places where id in (select fk from moz_bookmarks where parent in ( select "id" from moz_bookmarks where title == "'$favdir'"))'; ))
56 60
 fi
61
+cd  $dl_folder || exit
57 62
 
58 63
 ## Let youtube-dl do the work  and download brandnew videos ##
59
-cd $dl_folder || exit
60
-if [ $aria == 1 ]
61
-then
62
- for i in "${dbarray[@]}"; do
63
-youtube-dl --dateafter "$datum" --playlist-end "$perday" --max-downloads "$perday" --external-downloader aria2c --external-downloader-args '-c -j 3 -x 3 -s 3 -k 1M' "$i"
64
- done
65
- else
66
- for i in "${dbarray[@]}"; do
67
-youtube-dl --dateafter "$datum" --playlist-end "$perday" --max-downloads "$perday" "$i"
68
- done
69
-fi
64
+## Wenn die Variable zaehl aktiviert ist, kann der parameter eingebaut werden.
65
+##--download-archive $dl_folder/archive/archive-$zaehl.txt
66
+
67
+for i in "${dbarray[@]}"; do
68
+((zaehl++))
69
+youtube-dl $aria2 --dateafter "$datum" --playlist-end "$perday" --max-downloads "$perday" "$i"
70
+# echo $i
71
+done
72
+
73
+
74
+## optional ##
70 75
 
71
-## optional show downloadfolder ##
72 76
 # dolphin $dl_folder
73
-# f=$(find -ctime 1) ; notify-send "New vidoclips": "$f" --icon=video-x-generic
77
+## send-notify ##
78
+# f=$(find $dl_folder -mtime 0,2 -type f -regex '.*\.\(mkv\|mp4\|wmv\|flv\|webm\|mov\)') && notify-send "Neue Videos": "$f" --icon=video-x-generic
79
+