Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 25

Thread: ubuntu 13.04 select applications to open when media player is detected ?

  1. #11
    Join Date
    Nov 2005
    Beans
    822
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: ubuntu 13.04 select applications to open when media player is detected ?

    cool I got it, and it's on the list but it does not start when I plugin any media device for some reason

    The script is executable and is a pythons script. I'm fairly sure I have the full path correct and I used the entire path/file.py

  2. #12
    Join Date
    Nov 2005
    Beans
    822
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: ubuntu 13.04 select applications to open when media player is detected ?

    Quote Originally Posted by stinkeye View Post
    Yep.
    Must use %U in the Exec line of the .desktop file as shown earlier.
    Yep I have that and I do see my item in the menu now
    However it's not in the dash in fact the use-copy entry is there even though I edited the file again to get rid of that entry

    And it does not autostart for some reason but I can click the file manually and it's executable for sure.
    Wonder why it won't run
    Last edited by AgentZ86; June 21st, 2013 at 02:34 AM.

  3. #13
    Join Date
    Oct 2008
    Beans
    3,509

    Re: ubuntu 13.04 select applications to open when media player is detected ?

    Quote Originally Posted by AgentZ86 View Post
    Yep I have that and I do see my item in the menu now
    However it's not in the dash in fact the use-copy entry is there even though I edited the file again to get rid of that entry

    And it does not autostart for some reason but I can click the file manually and it's executable for sure.
    Wonder why it won't run
    What's the Exec line in your .desktop file?

    I tested with a bash script that sends to the notification bubble "MP3 player connected".
    Works after choosing usb-copy as the application to use when I plug in my mp3 player or if I select "ask what to do" then choose usb-copy when media connected.

    usb-copy also appears in nautilus as the application to use when opening to the music player.
    Clicking on the usb-copy button(see pic), runs the bash script again.

    The ~/.local/share/applications/usb-copy.desktop file...
    Code:
    [Desktop Entry]
    Version=1.0
    Type=Application
    Terminal=false
    Icon=gnome-panel-launcher
    Name=usb-copy
    Exec=/home/glen/scripts/desktop-test.sh %U
    Comment=usb script
    The /home/glen/scripts/desktop-test.sh script
    Code:
    #!/bin/bash
    
    notify-send -i multimedia-player "Music Player connected"
    # cp /home/glen/cptest.txt /media/glen/SANSA-CLIPP
    Also worked to copy a test file when uncommenting the second command in the bash script.
    Attached Images Attached Images
    Last edited by stinkeye; June 21st, 2013 at 05:51 AM.

  4. #14
    Join Date
    Nov 2005
    Beans
    822
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: ubuntu 13.04 select applications to open when media player is detected ?

    http://bpaste.net/show/khvCKc9wdJG9ju0f2ylE/

    Here is the script with the top liine which makes the script a clickable auto execute.
    It's a python script not a bash script and it does work when clicking the file
    So that could be part of my problem

    As far as the name and comments go I assumed the name would be the name of the script or whatever I wanted. Does that part matter ?

    And my full path is

    [Desktop Entry]
    Version=1.0
    Type=Application
    Terminal=false
    Icon=gnome-panel-launcher
    Name=usb_devices
    Exec=/home/agent86/Documents/usb_devices %U
    Comment=usb_devices
    My script is no longer in any lists or applications anywhere for some reason. Not in the dash,applications menus, system settings etc.
    I also duplicated exactly what you have here made it executable and can run the script which will copy files but is not found anywhere to select it to run for any reason or any menu

    Also I was not aware that you could use the full path of an mtp device in the same was as a usb devices.
    I could not find any such path for my sansa clip+ or Zen players
    I would love to change my code to make it call the console to copy the files instead that would be much easier if I new the path I could simply use the cp command as you did


    My python script is just testing right now so it copies files to another folder currently and not really to the device itself until I can work out the mtp device topics some more.
    Perhaps I should write a bash call instead this might make it easier to copy files to mtp since that is a problem with python with limited libraries for this.

    Also when I simply use the console and type
    cp /home/agent86/Documents/6_19_2013.flac /media/agent86/CREATIVE-ZEN
    I get permissions issues says permission denied

    Or this:
    cp /home/agent86/Documents/6_19_2013.flac /CREATIVE
    Produces no errors or messages and returns to prompt but does not copy any files either.


    In the mean time I do need to work out how to run an applications when the devices are detected too I'll play with your examples a little and see if I can figure out whats going on.
    Thanks
    Last edited by AgentZ86; June 21st, 2013 at 02:53 PM.

  5. #15
    Join Date
    Oct 2008
    Beans
    3,509

    Re: ubuntu 13.04 select applications to open when media player is detected ?

    Python and any sort of coding is beyond me except simple bash.
    The reason I bought a sansa clip+ is it has the option of MTP or MSC in
    settings > system settings > usb mode
    It's set to MSCso I can use just like a flash drive and drag and drop files or copy to.
    I believe the zen has the same option.

    When set to MTP I can't even view the files on my sansa.
    144.jpg


    When set to MSC can browse like any other mounted drive.
    145.jpg
    Last edited by stinkeye; June 21st, 2013 at 04:22 PM.

  6. #16
    Join Date
    Nov 2005
    Beans
    822
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: ubuntu 13.04 select applications to open when media player is detected ?

    Quote Originally Posted by stinkeye View Post
    Python and any sort of coding is beyond me except simple bash.
    The reason I bought a sansa clip+ is it has the option of MTP or MSC in
    settings > system settings > usb mode
    It's set to MSCso I can use just like a flash drive and drag and drop files or copy to.
    I believe the zen has the same option.

    When set to MTP I can't even view the files on my sansa.
    144.jpg


    When set to MSC can browse like any other mounted drive.
    145.jpg
    Yeah I know about the msc mode.
    Ok forget the media players for now I'll just use a usb flash drive to simulate this or I'll use the sansa clip + which I also have.
    Shouldn't the usb device like a flash drive also activate the script ?

    I have created the exact script you have done and I still do not get the script item in any available application list on any part of ubuntu.

    Strange because when I first did this with your instruction for usb-copy the item was there the very first time but is now gone
    I see the files in the .desktop folder but no effect.
    Now I can't create ANY items no matter what I call them. They are being created in the .deskop folder for sure.
    But no application items in dash,system settings or right clicks to open etc etc.

    I'll keep playing with it but I'm stumped
    Last edited by AgentZ86; June 22nd, 2013 at 02:11 PM.

  7. #17
    Join Date
    Nov 2005
    Beans
    822
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: ubuntu 13.04 select applications to open when media player is detected ?

    Ok I removed all the files and started over
    Created a script with only this:
    #!/bin/bash

    notify-send -i multimedia-player "Music Player connected"
    It's executable and is in the lists.
    I can manually run or click the script but it will not notify or run when anything is plugged in for some reason.
    OUCH this is bugging me LOL
    Last edited by AgentZ86; June 22nd, 2013 at 02:32 PM.

  8. #18
    Join Date
    Oct 2008
    Beans
    3,509

    Re: ubuntu 13.04 select applications to open when media player is detected ?

    Doesn't work for me with a normal usb flash drive.
    Only with the sanza when in MSC mode.

    FYI this is my ~/.local/share/applications/mimeapps.list file
    It has an entry....x-content/audio-player=usb-copy.desktop
    Code:
    [Default Applications]
    application/x-deb=gdebi.desktop
    audio/x-vorbis+ogg=totem.desktop
    audio/3gpp=totem.desktop
    audio/ac3=totem.desktop
    audio/AMR=totem.desktop
    audio/AMR-WB=totem.desktop
    audio/basic=totem.desktop
    audio/flac=totem.desktop
    audio/midi=totem.desktop
    audio/mp2=totem.desktop
    audio/mp4=totem.desktop
    audio/mpeg=totem.desktop
    audio/mpegurl=totem.desktop
    audio/ogg=totem.desktop
    audio/prs.sid=totem.desktop
    audio/vnd.rn-realaudio=totem.desktop
    audio/x-aiff=totem.desktop
    audio/x-ape=totem.desktop
    audio/x-flac=totem.desktop
    audio/x-gsm=totem.desktop
    audio/x-it=totem.desktop
    audio/x-m4a=totem.desktop
    audio/x-matroska=totem.desktop
    audio/x-mod=totem.desktop
    audio/x-mp3=totem.desktop
    audio/x-mpeg=totem.desktop
    audio/x-mpegurl=totem.desktop
    audio/x-ms-asf=totem.desktop
    audio/x-ms-asx=totem.desktop
    audio/x-ms-wax=totem.desktop
    audio/x-ms-wma=totem.desktop
    audio/x-musepack=totem.desktop
    audio/x-pn-aiff=totem.desktop
    audio/x-pn-au=totem.desktop
    audio/x-pn-realaudio=totem.desktop
    audio/x-pn-realaudio-plugin=totem.desktop
    audio/x-pn-wav=totem.desktop
    audio/x-pn-windows-acm=totem.desktop
    audio/x-realaudio=totem.desktop
    audio/x-real-audio=totem.desktop
    audio/x-s3m=totem.desktop
    audio/x-sbc=totem.desktop
    audio/x-scpls=totem.desktop
    audio/x-speex=totem.desktop
    audio/x-stm=totem.desktop
    audio/x-tta=totem.desktop
    audio/x-wav=totem.desktop
    audio/x-wavpack=totem.desktop
    audio/x-vorbis=totem.desktop
    audio/x-xm=totem.desktop
    x-scheme-handler/mailto=opera-browser.desktop
    x-scheme-handler/http=opera-browser.desktop
    text/html=opera-browser.desktop
    text/xml=opera-browser.desktop
    application/xhtml+xml=opera-browser.desktop
    text/vnd.wap.wml=opera-browser.desktop
    text/wml=opera-browser.desktop
    application/x-mimearchive=opera-browser.desktop
    application/mime=opera-browser.desktop
    application/xml=opera-browser.desktop
    application/rss+xml=opera-browser.desktop
    application/rdf+xml=opera-browser.desktop
    image/svg+xml=eog.desktop
    application/x-opera-extension=opera-browser.desktop
    x-scheme-handler/https=opera-browser.desktop
    x-scheme-handler/ftp=opera-browser.desktop
    video/ogg=opera-browser.desktop
    image/webp=opera-browser.desktop
    image/jpeg=eog.desktop
    image/bmp=eog.desktop
    image/gif=eog.desktop
    image/png=eog.desktop
    image/tiff=eog.desktop
    image/x-bmp=eog.desktop
    image/x-ico=eog.desktop
    image/x-png=eog.desktop
    image/x-pcx=eog.desktop
    image/x-tga=gthumb.desktop
    image/xpm=gthumb.desktop
    image/jpg=eog.desktop
    image/pjpeg=eog.desktop
    image/x-gray=eog.desktop
    image/x-icb=eog.desktop
    image/x-portable-anymap=eog.desktop
    image/x-portable-bitmap=eog.desktop
    image/x-portable-graymap=eog.desktop
    image/x-portable-pixmap=eog.desktop
    image/x-xbitmap=eog.desktop
    image/x-xpixmap=eog.desktop
    image/svg+xml-compressed=eog.desktop
    image/vnd.wap.wbmp=eog.desktop
    inode/directory=nautilus.desktop
    application/x-gnome-saved-search=nautilus.desktop
    audio/vorbis=totem.desktop
    audio/x-adpcm=totem.desktop
    audio/x-mp2=totem.desktop
    video/avi=totem.desktop
    video/mp4=totem.desktop
    video/flv=totem.desktop
    video/x-ms-wmv=totem.desktop
    video/x-ogm=totem.desktop
    video/x-theora=totem.desktop
    image/x-xcursor=gedit.desktop
    video/x-sgi-movie=totem.desktop
    video/mpeg=totem.desktop
    x-content/audio-player=usb-copy.desktop
    
    [Added Associations]
    application/x-deb=gdebi.desktop;
    application/x-sqlite3=gedit.desktop;
    audio/ac3=totem.desktop;totem.desktop;
    audio/mp4=totem.desktop;totem.desktop;
    audio/mpeg=totem.desktop;rhythmbox.desktop;clementine.desktop;totem.desktop;
    audio/mpegurl=totem.desktop;totem.desktop;
    audio/ogg=gedit.desktop;opera-browser.desktop;
    audio/vnd.rn-realaudio=totem.desktop;totem.desktop;
    audio/x-flac=totem.desktop;rhythmbox.desktop;
    audio/x-matroska=totem.desktop;totem.desktop;
    audio/x-mp3=totem.desktop;totem.desktop;rhythmbox.desktop;
    audio/x-mpeg=totem.desktop;rhythmbox.desktop;
    audio/x-mpegurl=totem.desktop;totem.desktop;rhythmbox.desktop;
    audio/x-ms-wma=totem.desktop;totem.desktop;
    audio/x-pn-realaudio=totem.desktop;totem.desktop;
    audio/x-scpls=totem.desktop;totem.desktop;rhythmbox.desktop;
    audio/x-wav=totem.desktop;totem.desktop;
    audio/x-vorbis=totem.desktop;totem.desktop;
    text/html=opera-browser.desktop;
    text/xml=opera-browser.desktop;
    application/xhtml+xml=opera-browser.desktop;
    text/vnd.wap.wml=opera-browser.desktop;
    text/wml=opera-browser.desktop;
    application/x-mimearchive=opera-browser.desktop;
    application/mime=opera-browser.desktop;
    application/xml=opera-browser.desktop;
    application/rss+xml=opera-browser.desktop;
    application/rdf+xml=opera-browser.desktop;
    image/svg+xml=opera-browser.desktop;gthumb.desktop;eog.desktop;
    application/x-opera-extension=opera-browser.desktop;
    x-scheme-handler/https=opera-browser.desktop;
    x-scheme-handler/ftp=opera-browser.desktop;
    video/ogg=opera-browser.desktop;
    video/webm=opera-browser.desktop;
    image/webp=opera-browser.desktop;
    image/bmp=gthumb.desktop;eog.desktop;
    image/gif=gthumb.desktop;eog.desktop;
    image/png=gthumb.desktop;eog.desktop;
    image/tiff=gthumb.desktop;eog.desktop;
    image/x-bmp=gthumb.desktop;eog.desktop;
    image/x-ico=gthumb.desktop;eog.desktop;
    image/x-png=gthumb.desktop;eog.desktop;
    image/x-pcx=gthumb.desktop;eog.desktop;
    image/x-tga=gthumb.desktop;
    image/xpm=gthumb.desktop;
    application/octet-stream=file-roller.desktop;gedit.desktop;
    x-scheme-handler/mailto=thunderbird.desktop;opera-browser.desktop;
    image/jpg=eog.desktop;
    image/pjpeg=eog.desktop;
    image/x-gray=eog.desktop;
    image/x-icb=eog.desktop;
    image/x-portable-anymap=eog.desktop;
    image/x-portable-bitmap=eog.desktop;
    image/x-portable-graymap=eog.desktop;
    image/x-portable-pixmap=eog.desktop;
    image/x-xbitmap=eog.desktop;
    image/x-xpixmap=eog.desktop;
    image/svg+xml-compressed=eog.desktop;
    image/vnd.wap.wbmp=eog.desktop;
    image/x-xcursor=gedit.desktop;shotwell.desktop;gthumb.desktop;gimp.desktop;
    application/x-shellscript=gedit.desktop;file-roller.desktop;
    application/x-font-ttf=gnome-font-viewer.desktop;file-roller.desktop;
    text/x-python=gedit.desktop;
    video/x-ms-wmv=totem.desktop;
    text/plain=eog.desktop;truecrypt.desktop;
    audio/x-vorbis+ogg=totem.desktop;totem.desktop;
    video/x-ogm+ogg=totem.desktop;
    video/avi=totem.desktop;
    video/mp4=totem.desktop;
    video/flv=totem.desktop;
    video/quicktime=totem.desktop;
    video/vnd.rn-realvideo=totem.desktop;
    video/x-matroska=totem.desktop;
    video/x-ms-asf=totem.desktop;
    video/x-msvideo=totem.desktop;
    video/x-ogm=totem.desktop;
    video/x-theora=totem.desktop;
    application/x-tar=nautilus.desktop;gedit.desktop;
    video/x-sgi-movie=totem.desktop;
    video/mpeg=totem.desktop;
    x-content/audio-player=vlc.desktop;
    What I have noticed is the x-content/audio-player=usb-copy.desktop line remains after
    changing the removable media settings back to "never prompt or start programs"
    So when inserting the sanza clip nothing is run but can be run from the usb-copy button in nautilus.
    001.jpg
    Last edited by stinkeye; June 22nd, 2013 at 03:02 PM.

  9. #19
    Join Date
    Nov 2005
    Beans
    822
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: ubuntu 13.04 select applications to open when media player is detected ?

    I actually tried it with the sansa clipp plus and it works well

    I had assumed that it would run with other devices also
    Other mtp device like Zen seem to run rhythm box etc.

    Anyhow thanks
    Last edited by AgentZ86; June 22nd, 2013 at 04:15 PM.

  10. #20
    Join Date
    Nov 2005
    Beans
    822
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: ubuntu 13.04 select applications to open when media player is detected ?

    One last think on this

    The sansa clip path says home/user/sansa clip

    However this directory is not accessible and when using the ls command I get this

    No such file or directory

    Strange I can cd /media/agent86
    then ls and see the directories for my flash drive and sansa clip

    But if I cd DE30-94A7 works perfectly for the flash drive

    If I cd sansa clip it says no such file or directory

    I can't really access the sansa disk and do not appear to know what the real rull path is.

    This is a separate topic really but related to this media player
    I have no idea why I can't asccess is in msc mode this way from the commandline
    Please advise


    P.S
    My stupid python script when running it manually does access the sansa clip using path
    Dir4 = "/media/agent86/sansa clip/"

    This is a variable I made in my python script but it copies files with shutil and works with this path but copies very slowly
    I was going to change this and simply use a simply bash as you outlined here but I can't figure out the path for my sansa clip
    Last edited by AgentZ86; June 23rd, 2013 at 04:40 PM.

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •