Commits

lan Nomar  committed 9d428e0

net/todl.brc: Massive cleanup
small/readoc.brc: bugfix, uses locate properly
tools/browser.brc: poor netsurf and dillo support

  • Participants
  • Parent commits 29a10c9

Comments (0)

Files changed (4)

File net/todl.brc

 #!/usr/bin/env brc
 
-#	unify commands to functions
-#	a command that 
-#	remove links function
-		
+# check to see which files need removing
+# nicer output, prints titles and link that is currently downloading
+	
 nl='
 '
 
-file=$HOME/Oven/Docs/Todo/links
-Tfile=/tmp/keeplinks
+#file=$HOME/Oven/Docs/Todo/links
+quviDir = /usr/local/share/libquvi-scripts/lua/website
+support = ( quvi cclive )
+~ $#* 0	&& echo nothing, exiting && exit 1
 
+fn dowlnoad { cclive --progressbar simple --output-dir $HOME/Hideo/misc/ $* }
 
-#fn Support	{
-#	quviDir = /usr/local/share/libquvi-scripts/lua/website
-#		cd $quviDir
-#	*=$* ifs=. {	#( ls *.lua | sed s/.lua//g )#
-#	  for ( * in *.lua ) {
-#		* = `{ echo -n $* }
-#		sites = ( $sites $1 ) 
-#}	}	}	}
+fn Support	{
+	cd $quviDir
+	*=$* ifs=. {	#( ls *.lua | sed s/.lua//g )#
+	  for ( * in *.lua ) {
+		* = `{ echo -n $* }
+		sites = ( $sites $1 ) 
+}	} }
 
 *=$* {
-  for ( * in `` ($nl) { cclive --support | tr -d '%' } ) {
-	* = `{ echo $1 }
-	* = `{ echo $1 }
+  for ( * in `` ($nl) { $support(1) --support | tr -d '%' } ) {
+	* = `{ echo $* }
+	* = `{ echo -n $1 }
 	* = `` '|' { echo -n $* }
 	sites = ( $sites $* ) 
 } }
 
+supported = ( $sites youtu.be )
 
-fn readitlater {
+file = $^*
+
+if ( ~ $file *sqlite ) {
 	file = $HOME^'/.mozilla/firefox/hd2vm0qe.default/readItLater.sqlite'
-
-  for ( * in `` ($nl) { sqlite3 $^file '.dump items' } ) {
-	ifs = , {
+	
+	for ( * in `` ($nl) { sqlite3 $^file '.dump items' } ) {
+	  ifs = , {
 		* = `{ echo -n $* | tr -d '''' }
-		if (~ $3 *$sites/* *$sites/* ){
-			link	= ( $link	$3 )
+		if (~ $3 *$supported/* *$supported/* ){
+			links	= ( $links	$3 )
 		  	title	= ( $title	$4 )
-  } }	}
-  
-  *=()
-	for ( title in $title ){
-		* = ($* 1)
-		echo $title $^nl '	' $link($#*)
+}	} } } else {
+	delete = 1
+	for ( * in `` ($nl) { cat $file } ) {
+		~ $* *$supported/* *$supported/* && \
+			links = ( $links $* )
 }	}
 
-
-# File
-~ $#* 0	&& readitlater || $^*
-
-
-cclive --output-dir $HOME/Hideo/misc/ $link
-
-
-
-
-fn oldcode {
-for (line in `` ($nl) {cat $file}){
-	if (~ $line *^'youtube.com/watch?'^* *^youtu.be/^*){
-		echo 'Downloading:' $line
-		cclive $line
-	} else {
-		keep=($keep $line)
-} }
-
-echo > $file
-
-for (* in $keep) { echo $* >> $file }
-
-while (!~ $#seq 20){
-	seq=($seq 1)
-	echo >> $file
-}	}
-
-fn old { 
-  awk '{
-	if ( /youtu?be*/ )
-		system ("cclive --progressbar simple --output-dir '^$^HOME^/Hideo/^' "$0)
-	else
-		print $0
-  }' $file > /tmp/links
-
-  #( Temporal File )#
-	cat /tmp/links > $file
-	rm /tmp/links
+*=()
+  while ( ! ~ $#* $#title ) {
+	* = ($* 1)
+	echo $title($#*) $nl^'	'^$links($#*)
 }
 
-fn oldoldoldocode {
+echo $links
 
-ifs=$nl { * = `{  grep -E 'youtu?be' $file } }
-for ( * in $* ) { 
-	~ $^* 'http://'* || *='http://'$^*
-		cclive --progressbar simple --output-dir $^HOME^/Hideo/ $^* &&\
-			dl=($dl -v $^*)
-}
-
-if (!~ $#dl 0 ) {
-	grep $dl $file > $Tfile
-		cat $Tfile > $file
-		rm $Tfile
-}
-}
+dowlnoad $links

File small/readitlater.brc

File contents unchanged.

File small/readoc.brc

 { . `{ module.brc std } }
 #{ . parseflags.brc } ; *=$ARGS
 
-fn setfile { file = `{ locate $^* } }
+fn setfile { file = `` ($nl) { locate $^* } }
 
 switch ( $#* ) {
 	case 0 ; echo no mind reader

File tools/browser.brc

 { . `{ module.brc parseflags } $* } ; nl='
 '
 SaveFile=$HOME/Oven/Docs/Notes/URLMark
-GB=(Links Surf Midori Firefox Opera)
+GB=(Netsurf dillo Links Surf Midori Firefox Opera)
 TB=(w3m Links)
 
 if (!~ $#args 0) { URL=$args }	
   case [Ff]irefox* [Ff]ox	; firefox $URL
   case [Ss]urf				; surf $URL(1) &
   case [Ll]inks				; links -g $URL(1) &
+  case [Nn]etsurf			; netsurf $URL &
+  case [Dd]illo				; dillo $URL &
   case *					; browser -b $GB(1) $URL
 }	} else {
  switch( $flagb ){