Browse code

change source by variable: array or db

dewomser authored on30/10/2018 09:27:15
Showing1 changed files

... ...
@@ -1,25 +1,28 @@
1 1
 #!/bin/bash
2 2
 ## This Shellscript downloads all fresh videos from afirefox favorite folder. ##
3 3
 
4
+## Config ##
5
+
4 6
 ## update youtube-dl ##
5 7
 ## "youtube-dl -U" or "pip youtube-dl install" ##
6 8
 # pip install --upgrade youtube-dl
7
-# sleep 5
9
+# sleep 3
8 10
 
9
-## Variables ##
10 11
 ## Firefox manages bookmarks from database. ##
12
+## All firefox instances must be killed.
13
+## Reason is: Error: database is locked
14
+killall -9 firefox; sleep 3
11 15
 
12
-# All firefox intances must be killed.
13
-# Reason is: Error: database is locked
16
+## from Firefox bookmarks ##
17
+## change *default* if you have other profiles than default. ##
18
+cd ~/.mozilla/firefox/*default* || exit
14 19
 
15
-killall -9 firefox; sleep 3
20
+## Variables ##
16 21
 
17
-# #save all your Youtube playlists in $favdir ##
22
+## save all your Youtube playlists in $favdir ##
18 23
 favdir="bestof"
19
-echo $favdir
20 24
 ## Download folder ##
21 25
 dl_folder="/home/foo/Downloads/youtube-dl/"
22
-echo  $dl_folder
23 26
 ## Date= yesterday ##
24 27
 datum=$(date -d "1 day ago" '+%Y%m%d')
25 28
 ## Videos per day in each playlist##
... ...
@@ -27,26 +30,31 @@ perday=4
27 30
 ## if aria2 is installed example : ##
28 31
 # aria2='--external-downloader aria2c  --external-downloader-args "-j 8 -s 8 -x 8 -k 5M"'
29 32
 aria2=''
33
+## load from database or array
34
+loadfrom=database
30 35
 
31
-## from Firefox bookmarks ##
32
-## change *default* if you have other profiles than default. ##
33
-## comment if you load from array ##
34
-cd ~/.mozilla/firefox/*default* || exit
36
+## Start 
35 37
 
36
-## uncomment if you  load from an array ##
37
-## No Firefox no variables needed ##
38
-# dl_folder="~/Downloads"
39
-# perday=4
40
-# dbarray=(
41
-# "https://www.youtube.com/user/example-foo"
42
-# "https://www.youtube.com/channel/example-bar/videos?sort=dd&shelf_id=0&view=0"
43
-# )
38
+# echo $favdir
39
+# echo  $dl_folder
44 40
 
45
-## comment this if you load from array ##
46
-## this line puts FF favourites from sqlite3 to an array ##
47
-dbarray=( $(sqlite3 -list places.sqlite 'select url from moz_places where id in (select fk from moz_bookmarks where parent in ( select "id" from moz_bookmarks where title == "'$favdir'"))'; ))
41
+## only edit dbarray content if you want to use it
48 42
 
49
-## this  must not be commented ##
43
+if [ $loadfrom == array ]
44
+then
45
+ dbarray=(
46
+ "https://www.youtube.com/user/GalileoOffiziell/videos"
47
+ "https://www.youtube.com/user/BibisBeautyPalace/videos?sort=dd&shelf_id=1&view=0"
48
+ "https://www.youtube.com/channel/UC53bIpnef1pwAx69ERmmOLA"
49
+ )
50
+##
51
+##--------------------Do not edit below this line ! -----------------------
52
+##
53
+ 
54
+else
55
+ ## this line puts FF favourites from sqlite3 to an array ##
56
+ dbarray=( $(sqlite3 -list places.sqlite 'select url from moz_places where id in (select fk from moz_bookmarks where parent in ( select "id" from moz_bookmarks where title == "'$favdir'"))'; ))
57
+fi
50 58
 cd  $dl_folder || exit
51 59
 ## let youtube-dl do the work  and download brandnew videos##
52 60
 # 
... ...
@@ -55,5 +63,5 @@ youtube-dl $aria2 --dateafter "$datum" --playlist-end "$perday" --max-downloads
55 63
 # echo $i
56 64
 done
57 65
 
58
-## optional ###
66
+## optional ##
59 67
 #dolphin $dl_folder