Scripts for Nautilus (Linux file browser)

Search This thread

MappaM

Member
Nov 20, 2008
49
1
Liège
www.itstudents.be
Hello !

I wrote some scripts for easily pushing and installing files/apks to your android device.

The advantage over "command line" and other scripts like mine :
- Multiple selection allowed (install 100 APKs in one click ! )
- You have a progress bar (shows only the progression between multiples files/ not the state of a single pushing).
- You can choose the destination on your phone with a simple prompt by choosing "Push to ..."
- It's a very simple and lightweight nautilus script...
- You don't have to (in fact, you can't) put the usb in "usb disk" mode, just have debugging enabled.

Examples
To simply install some applications, just select them, right click, go to scripts->ADB->install
001.png


Progression :
002.png


Idem for files :
003.png


Progress :
004.png


Confirmation :
005.png


(So the "Push to ..." allow you to choose a destination. "Push to musique" is just a copy of "Push to sdcard" with the second line of the script changed to copy files to /sdcard/music/ instead of /sdcard/ ;) )

How to install
- Download the scripts :
- Uncompress the files in ~/.gnome2/nautilus_scripts/ADB/
So if your name is mario, you should copy the 3 files to :
/home/mario/.gnome2/nautilus-scripts/ADB/
You are not obliged to make the last folder named ADB, it's just to make "categories" in the Nautilus script menu (like in the screenshots)​

Requirements
- A correctly installed ADB

What is a correctly installed ADB?
- The PATH environment variable has to be set, to be able to just type "adb" and not "/path/to/sdk/platform-tools/adb". If it's not done :
Edit the file ~/.bashrc , you can do that by typing in the console
Code:
gedit ~/.bashrc
and add this line changed for yourself at the end of the file
Code:
export PATH=${PATH}:/path/to/android-sdk-linux_86/platform-tools/

Or, if this does'nt work :

Edit the file /etc/environment , you can do that by typing in the console
Code:
gedit /etc/environment
and add this text changed for yourself at the end of the line "PATH:", before the last ["]
Code:
:/path/to/android-sdk-linux_86/platform-tools/



- The rules for udev have to be made to allow any non-root user to access to the device
Method for any HTC device :
Edit with root rights the file /etc/udev/rules.d/51.android.rules by typing in the console :
Code:
gksudo gedit /etc/udev/rules.d/51.android.rules
and add the lines :
Code:
SUBSYSTEM=="usb|usb_device", SYSFS{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"

Hope you'll enjoy !

Please correct my english ;)
 
Last edited:

pietro_spina

Senior Member
Jul 20, 2010
178
21
Western MA
Stupid me...

http://www.kmel.be/~tom/android/ADB Scripts for Nautilus.tar.gz

Please note a little "bug", the progress bar progress when a file start transfer. So if you send just one big file, it will be at 100% for a little time...
Easily correctible, but I haven't the time now...

nice work. very handy
EDIT: actually I may have spoke too soon, these don't seem to be working for me. Ubuntu 10.10
I know my udev and $PATH are all set up correctly. So I'm not sure where these are failing for me..
any thoughts?
EDIT2: OK it was a $PATH issue the ~.bashrc however is only for interactive non login shells adding the adb path to ~.profile and a re-login solved my problem with this script. Or alternatively you could call adb in the script using it's full path.
 
Last edited:

pietro_spina

Senior Member
Jul 20, 2010
178
21
Western MA
Thanks MappaM for the great base script!

Here is my version of "Push to Movies":
My solution to the immediately full progress bar was to use the --pulsate option in zenity this works for me because I am likely to only be sending one file anyway and don't need the fine grain feed back of an incremental progress bar. The one that bounces back and forth is what you will see.

echo "15" ; sleep 1
is a hack, you may not need it but for me it lets the pulsate flag work.

zenity bugs reported here
https://bugs.launchpad.net/zenity/+bug/291850
https://bugzilla.gnome.org/show_bug.cgi?id=567663

Code:
#!/bin/sh

#this is MY path, your path will be different . change this path.
android_path="/sdcard/media/video/movies/"
i=1
(
for thing in "[email protected]"
do
# this first echo tricks the pulsate into working you may not need it. try it both with and without it.
	echo "15" ; sleep 1 
	echo $(($i * 100 / $#))
	echo "# Pushing \"${thing}\"" ; 
	adb push "${thing}" $android_path
	i=$(($i+1))
	
done; i=$(($i-1)) ; echo "# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $android_path"
 
  • Like
Reactions: Tahl

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Stupid me...

    http://www.kmel.be/~tom/android/ADB Scripts for Nautilus.tar.gz

    Please note a little "bug", the progress bar progress when a file start transfer. So if you send just one big file, it will be at 100% for a little time...
    Easily correctible, but I haven't the time now...
    1
    Thanks MappaM for the great base script!

    Here is my version of "Push to Movies":
    My solution to the immediately full progress bar was to use the --pulsate option in zenity this works for me because I am likely to only be sending one file anyway and don't need the fine grain feed back of an incremental progress bar. The one that bounces back and forth is what you will see.

    echo "15" ; sleep 1
    is a hack, you may not need it but for me it lets the pulsate flag work.

    zenity bugs reported here
    https://bugs.launchpad.net/zenity/+bug/291850
    https://bugzilla.gnome.org/show_bug.cgi?id=567663

    Code:
    #!/bin/sh
    
    #this is MY path, your path will be different . change this path.
    android_path="/sdcard/media/video/movies/"
    i=1
    (
    for thing in "[email protected]"
    do
    # this first echo tricks the pulsate into working you may not need it. try it both with and without it.
    	echo "15" ; sleep 1 
    	echo $(($i * 100 / $#))
    	echo "# Pushing \"${thing}\"" ; 
    	adb push "${thing}" $android_path
    	i=$(($i+1))
    	
    done; i=$(($i-1)) ; echo "# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $android_path"