uGet_category_selection script

Have you created a script, addon, plugin, extension or improvement to enhance uGet in some way? AWESOME! Please share your work here.

uGet_category_selection script

Postby fehhh » Wed Sep 12, 2012 10:18 am

I'm wrote script for automatic category selection in uGet depending of file types:
Code: Select all
#!/bin/bash
#uGet_category_selection  script by fehhh & Michael Tunnell

#Getting info about file types
DINFO=$(wget --spider "$1" 2>&1)

#Selecting category
if echo "$DINFO" | egrep -e 'application\/x.bittorrent'; then
    uget-gtk $1 $2 --category-index=6
elif echo "$DINFO" | egrep -e 'application\/x-cd-image'; then
    uget-gtk $1 $2 --category-index=7
elif echo "$DINFO" | egrep -e 'application\/(x.bzip2|x.gzip|x.tar|x.7z|rar|zip)'; then
    uget-gtk $1 $2 --category-index=1
elif echo "$DINFO" | egrep -e '(application|image|text)\/(pdf|msword|rtf|vnd.ms.excel|vnd.djvu|plain)'; then
    uget-gtk $1 $2 --category-index=2
elif echo "$DINFO" | egrep -e 'application\/octet.stream'; then
#For octet
            if echo "$1" | egrep -i -e '\.torrent'; then
                  uget-gtk $1 $2 --category-index=6
            elif echo "$1" | egrep -i -e '\.(iso|img)'; then
                  uget-gtk $1 $2 --category-index=7
            elif echo "$1" | egrep -i -e '\.(bz2|gz|tgz|tar|rar|zip|7z)'; then
                  uget-gtk $1 $2 --category-index=1
            elif echo "$1" | egrep -i -e '\.(doc|rtf|xls|pdf|djvu|txt)'; then
                  uget-gtk $1 $2 --category-index=2
            elif echo "$1" | egrep -i -e '\.(avi|flv|mp4|wmv|mpg|mpeg|mkv)'; then
                  uget-gtk $1 $2 --category-index=3
            elif echo "$1" | egrep -i -e '\.(mp3|flac|ogg|ape|m4a)'; then
                  uget-gtk $1 $2 --category-index=4
            elif echo "$1" | egrep -i -e '\.deb'; then
                  uget-gtk $1 $2 --category-index=5
            else
                  uget-gtk $1 $2 --category-index=0
            fi
elif echo "$DINFO" | egrep -e 'application\/x.debian.package'; then
        uget-gtk $1 $2 --category-index=5
elif echo "$DINFO" | egrep -e 'video\/(x.flv|mp4|x.msvideo|x.ms.wmv|mpeg|x.matroska)'; then
        uget-gtk $1 $2 --category-index=3
elif echo "$DINFO" | egrep -e 'audio\/(mpeg|flac)'; then
        uget-gtk $1 $2 --category-index=4
else
uget-gtk $1 $2 --category-index=0
fi

How to use:
  1. Create the uGet's categories only in this sequence:
    • Home
    • Archives
    • Docs
    • Movies
    • Music
    • Packages
    • Torrents
    • ISOs
    Otherwise, in the script will have to change the indexes of categories.
  2. chmod 774 your_script_name.sh
  3. move your_script-name.sh to the folder "/usr/bin"
  4. add script to Firefox FlashGot with "command line arguments template":
    Code: Select all
    --filename=[FNAME] [URL]

Enjoy!

Moderator Message:
This topic has inspired the new Community Scripts forum and has been moved from Stable Release Help to Community Scripts.
- MichaelTunnell
translated by google translate
fehhh
 
Posts: 7
Joined: Sun Sep 09, 2012 10:18 am
Linux Distro: Xubuntu 12.04

Re: uGet_category_selection script

Postby MichaelTunnell » Sun Sep 16, 2012 11:30 pm

This is a very cool idea and thank you for sharing your script.

Update: 2014-10-09
I cleaned up the How-To section so it is easier to read and to add content that was not previously provided. I also created an extra Category for ISO / IMG files as well as fixed the command line arguments template for FlashGot.
User avatar
MichaelTunnell
Site Admin
 
Posts: 492
Joined: Sun Sep 02, 2012 1:01 pm
Location: Alabama, USA
uGet Version: Latest Dev Build
Operating System: Linux
System Architecture: 64bit
Linux Distro: Kubuntu & Antergos

Re: uGet_category_selection script

Postby SteveSaus » Sat Nov 21, 2015 8:54 pm

Hey Michael, I'm coming to uGet from a dissatisfaction with KGet ... but I also use Liferea, which doesn't support uGet. In addition, the instructions as listed weren't working well with FlashGot for me with iceweasel. No idea why.

What did work?
1. Swapping
Code: Select all
uget-gtk $1 $2
to
Code: Select all
uget-gtk $2 $1
in every instance of the script.
2.
Code: Select all
chmod a+x uget_preprocessor.sh

3.
Code: Select all
sudo cp uget_preprocessor.sh /usr/bin/kget

4. Setting everything to use KGet.
5. Profit! (Or download. Whatever.)

Given how hard it was for me to find this post originally (and category auto-sorting is kind of a big thing for me), I wrote up the HOWTO and such along with my tweak of the script on GitHub, and I'll post it on my blog as well. Hopefully it'll draw some more folks to this pretty awesome download manager.
---
stevesaus.com
ideatrash.net
GPG key ID: 0xDD2F731F
User avatar
SteveSaus
 
Posts: 3
Joined: Sat Nov 21, 2015 8:45 pm
uGet Version: 1.10.4
Operating System: Linux
System Architecture: 64bit
Linux Distro: Debian Jessie

Re: uGet_category_selection script

Postby SteveSaus » Sun Nov 22, 2015 8:51 am

...and since uGet is cross platform, I decided to amuse myself by making a Windows script with the same functionality. It also gave me some ideas on simplifying the pattern matching simply because of the kludges I had to use with Windows.

Script is tested on an XP VM using Firefox, Flashgot, and uGet - all latest version.
---
stevesaus.com
ideatrash.net
GPG key ID: 0xDD2F731F
User avatar
SteveSaus
 
Posts: 3
Joined: Sat Nov 21, 2015 8:45 pm
uGet Version: 1.10.4
Operating System: Linux
System Architecture: 64bit
Linux Distro: Debian Jessie

Re: uGet_category_selection script

Postby MichaelTunnell » Wed Nov 25, 2015 11:55 am

Thank you SteveSaus for this improvement to the script and the integration with Liferea.

I abandoned Liferea a while ago due to it's lack of Tiny Tiny RSS support, I think they added something for it but when testing it was pretty much terrible.

Anyway, it looks like you are tricking Liferea into thinking that uGet is KGet. That is an interesting and cool approach to solve the issue. :)
User avatar
MichaelTunnell
Site Admin
 
Posts: 492
Joined: Sun Sep 02, 2012 1:01 pm
Location: Alabama, USA
uGet Version: Latest Dev Build
Operating System: Linux
System Architecture: 64bit
Linux Distro: Kubuntu & Antergos

Re: uGet_category_selection script

Postby SteveSaus » Tue Dec 13, 2016 7:40 pm

---
stevesaus.com
ideatrash.net
GPG key ID: 0xDD2F731F
User avatar
SteveSaus
 
Posts: 3
Joined: Sat Nov 21, 2015 8:45 pm
uGet Version: 1.10.4
Operating System: Linux
System Architecture: 64bit
Linux Distro: Debian Jessie


Return to Community Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron