Linux, UNIX i ostali unixoidi Open source OS-ovi i sve o njima |
|
06.12.2011., 20:31
|
#1
|
~me too~
Registracija: Mar 2009.
Lokacija: u birtiji
Postova: 746
|
skriptica za spremanje flash videa sa youtubea
napisa san nabrzinu skripticu za spremanje flash videa sa youtubea.
napisana je za bash, hardkodirano je misto spremanja (/home/user/Videos) jedino se ime more dati ka argument.
skripta nema komentara.
pokreće se ka se video do kraja učita.
testirano sa google-chrome web preglednikom.
pa ako komu ustriba...
Kod:
#! /bin/bash
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
flash_pid=$(ps aux | grep flash | grep -vi $0 |grep -vi grep | awk '{print $2}')
if [ -n "$flash_pid" ]
then
cd /proc/$flash_pid/fd/
flash_video=$(ls -al | grep Flash | awk '{print $8}')
if [ -n "$flash_video" ]
then
if [ -n "$1" ]
then
flash_video_name=$1
else
flash_video_name=$(date +%H%M%S).flv
fi
cp $flash_video ~/Videos/$flash_video_name
echo "Flash video copied to ~/Videos/$flash_video_name"
else
echo "Flash video not found in /proc/$flash_pid/fd/"
fi
else
echo "Flash video not found!"
fi
sve bugove, ispravke i komentare morete pisati ode, samo imajte na umu:
Quote:
This program 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
|
siguro postoju bolje skripte, plugini za firefox i slično.
ideju san dobi ode
i tamo ima isto neka skripta ka vjerojatno radi bolje.
|
|
|
06.12.2011., 23:24
|
#2
|
Registrirani korisnik
Registracija: Nov 2008.
Postova: 1,620
|
Pohvalno.
|
|
|
07.12.2011., 18:25
|
#3
|
Lives for the hunt
Registracija: Feb 2003.
Lokacija: Middle-earth
Postova: 8,807
|
Kod:
#!/bin/sh
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
Self="`basename $0`"
Usage()
{
cat <<- _EOF_ 1>&2
Usage: ${Self} [-o output file] [-h]
_EOF_
}
while getopts o:h Option
do
case "${Option}"
in
o)
OutputFile="${OPTARG}"
;;
h)
Usage
exit 0
;;
?)
Usage
exit 2
;;
esac
done
shift `expr ${OPTIND} - 1`
if [ $# -ne 0 ]
then
#
# Extra arguments, invalid.
#
Usage
exit 2
fi
FlashPID="`ps -ef | awk '$NF ~ /flash/ {print $2;}'`"
if [ "${FlashPID}" != "" ]
then
FlashVideo="`ls -l /proc/${FlashPID}/fd | awk '/Flash/ {print $8;}'`"
if [ "${FlashVideo}" != "" ]
then
OutputFile="${OutputFile:-`date +%H%M%S`.flv}"
fi
printf "%s: no flash video found in /proc/%d/fd/\n" "${Self}" "${FlashPI
D}" 1>&2
exit 1
else
printf "%s: no flash video found.\n" "${Self}" 1>&2
exit 1
fi
__________________
Alas for the weakness of the great! Mighty king is Gil-Galad, and wise in all lore is master Elrond, and yet they will not aid me in my labors. Can it be that they do not desire other lands to become as blissful as their own, nay, even as Valinor?
|
|
|
07.12.2011., 19:15
|
#4
|
Sneguljac-patuljak nudist
Registracija: Mar 2004.
Lokacija: shire
Postova: 18,287
|
e ovo je poso!
|
|
|
07.12.2011., 23:02
|
#5
|
Lives for the hunt
Registracija: Feb 2003.
Lokacija: Middle-earth
Postova: 8,807
|
Kod:
flgrab(1) flgrab(1)
NAME
flgrab - grab Adobe flash (.flv) video file
SYNOPSIS
flgrab [-o file] [-h]
DESCRIPTION
flgrab stores Adobe .flv stored in memory to a file. The program makes
use of GNU/Linux's /proc/fd to determine the file's file descriptor.
Without the -o option, flgrab writes the .flv file in the current
working directory, in the following format: 'date +%H%M%S'.flv.
flgrab should not be run unless the flash video has been fully down-
loaded in the web browser.
OPTIONS
-o file
Specify the filename of the flash video.
-h Print usage to standard error.
OPERANDS
file A path name of the output file, which can either be relative or
a full path name.
EXAMPLES
Example 1: capturing current video.
% flgrab
Example 2: capturing current video and specifying the output file.
% flgrab -o "${HOME}/Documents/Videos/Youtube.flv"
EXIT STATUS
The following exit values are returned:
0 no errors.
1 no file handle could be found in /proc/fd/.
2 usage error.
NOTES
Since it makes specific use of /proc/fd in GNU/Linux, flgrab is
GNU/Linux specific and therefore not portable; however, portable solu-
tions are welcome. Post suggestions and improvements at:
https://www.forum.hr/showthread.php?t=691539
ATTRIBUTES
+--------------------------+----------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------------+----------------------+
| Availability | ANTRflgrab |
+--------------------------+----------------------+
| Interface stability | evolving |
+--------------------------+----------------------+
SEE ALSO
BUGS
None known at this time.
AUTHOR
flgrab was originally created by Hermenegildo (see
https://www.forum.hr/showthread.php?p=37081469#post37081469); that code
was then rewritten by Annatar as a demonstration of writing portable
shell programs following UNIX conventions and norms.
COPYRIGHT
(C)2011 The free software foundation.
ANTRflgrab 07 Dec 2011 flgrab(1)
__________________
Alas for the weakness of the great! Mighty king is Gil-Galad, and wise in all lore is master Elrond, and yet they will not aid me in my labors. Can it be that they do not desire other lands to become as blissful as their own, nay, even as Valinor?
|
|
|
07.12.2011., 23:08
|
#6
|
Lives for the hunt
Registracija: Feb 2003.
Lokacija: Middle-earth
Postova: 8,807
|
Izvorna .t2t datoteka za generiranje dokumentacije u troff(1) formatu
Kod:
flgrab
ANTRflgrab
%%mtime(%d %b %Y)
%!postproc(man): "%t" '\t'
= NAME =
**flgrab** - grab Adobe flash (.flv) video file
= SYNOPSIS =
**flgrab**
""[""**-o** //file//""]""
""[""**-h**""]""
= DESCRIPTION =
**flgrab** stores Adobe .flv stored in memory to a file. The program makes use
of GNU/Linux's /proc/fd to determine the file's file descriptor.
Without the **-o** option, **flgrab** writes the .flv file in the current
working directory, in the following format: `date +%H%M%S`.flv.
**flgrab** should not be run unless the flash video has been fully downloaded in
the web browser.
= OPTIONS =
: **-o** //file//
Specify the filename of the flash video.
: **-h**
Print usage to standard error.
= OPERANDS =
: //file//
A path name of the output file, which can either be relative or a full path
name.
= EXAMPLES =
Example 1: capturing current video.
```
% flgrab
```
Example 2: capturing current video and specifying the output file.
```
% flgrab -o "${HOME}/Documents/Videos/Youtube.flv"
```
= EXIT STATUS =
The following exit values are returned:
: 0
no errors.
: 1
no file handle could be found in /proc/fd/.
: 2
usage error.
= NOTES =
Since it makes specific use of /proc/fd in GNU/Linux, **flgrab** is GNU/Linux
specific and therefore not portable; however, portable solutions are welcome.
Post suggestions and improvements at
https://www.forum.hr/showthread.php?t=691539
= ATTRIBUTES =
%
% || = title (bold)
% The alignment within the cells of the first row declares the alignment
% for all following rows.
%
|| ATTRIBUTE TYPE %t | ATTRIBUTE VALUE %t |
| Availability %t | ANTRflgrab %t |
| Interface stability %t | evolving %t |
= SEE ALSO =
= BUGS =
None known at this time.
= AUTHOR =
**flgrab** was originally created by Hermenegildo
(see https://www.forum.hr/showthread.php?p=37081469#post37081469);
that code was then rewritten by Annatar as a demonstration of writing portable
shell programs following UNIX conventions and norms.
= COPYRIGHT =
(C)2011 The free software foundation.
Generiranje man stranice s txt2tags,
Kod:
% txt2tags -t man -i flgrab.t2t -o flgrab.1
__________________
Alas for the weakness of the great! Mighty king is Gil-Galad, and wise in all lore is master Elrond, and yet they will not aid me in my labors. Can it be that they do not desire other lands to become as blissful as their own, nay, even as Valinor?
|
|
|
08.12.2011., 00:36
|
#7
|
Čita se ŠOKI
Registracija: Dec 2002.
Lokacija: Stubičke Toplice/Zagreb
Postova: 2,400
|
ahahaha
znao sam da neće moći odoljeti
|
|
|
08.12.2011., 23:06
|
#8
|
Registrirani korisnik
Registracija: Nov 2008.
Postova: 1,620
|
Quote:
Annatar kaže:
Kod:
#!/bin/sh
#
# This program is free software...
#
|
E jebi ga Annatare...taman je covjek dobio samopouzdanje....i onda mu zabijes strijelu u koljeno.
|
|
|
09.12.2011., 10:19
|
#9
|
~me too~
Registracija: Mar 2009.
Lokacija: u birtiji
Postova: 746
|
dosadašnje skripte ne omogućavaju skidanje više od 1 flash videa. Ako otvorite više tabova sa flash videom skripta neće raditi.
U slučaju da želite skinuti više filmova, otvorite ih u tabovima, pustite da se do karaja skinu svi i pokrenite modificiranu verziju :
Kod:
#! /bin/bash
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#Version=0.2
#Usage: saveflash [output_file1 output_file2 ... ]
#
exit_status=0
flash_pid=$(ps aux | grep flash | grep -vi $0 |grep -vi grep | head -1 | awk '{print $2}')
if [ -n "$flash_pid" ]
then
cd /proc/$flash_pid/fd/
flash_videos=$(ls -l | grep Flash | awk '{print $8}')
if test -z "$flash_videos"
then
exit_status=1
echo "Flash video not found!"
fi
for flash_video in $flash_videos
do
if [ -n "$1" ]
then
flash_video_name=$1.flv
shift
else
flash_video_name=$(date +%Hh-%Mm-%Ss).flv
fi
cp $flash_video ~/Videos/$flash_video_name
echo "Flash video copied to ~/Videos/$flash_video_name"
exit_status=0
done
else
echo "Flash video not found!"
exit_staus=1
fi
exit $exit_status
U ovoj skripti i dalje vrijede ista ograničenja.
Ime ne mora sadržavati nastavak jer se .flv automatski dodaje na kraj.
Ako skidate više filmova možete za svaki dati ime kao argument (ne morate dati ime videu, ako koje fali generira se).
Do sada je primjećeno da se filmovi spremaju po redoslijedu otvaranja u tabovima.
|
|
|
09.12.2011., 12:25
|
#10
|
Čita se ŠOKI
Registracija: Dec 2002.
Lokacija: Stubičke Toplice/Zagreb
Postova: 2,400
|
lol
e sad ga fasovao
|
|
|
|
Sva vremena su GMT +2. Trenutno vrijeme je: 09:14.
|
|
|
|