maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   gpodder - local folder as podcast (https://talk.maemo.org/showthread.php?t=73470)

sethkha 2011-05-26 09:25

gpodder - local folder as podcast
 
Hi
As it is easy to add a folder as a podcast to gpodder (point to xml file with: file:///path/to/a.xml), I am asking for somebody to help me writing a script for a convenient generation of the needed xml file.
Yes, I can do this on my own, but if there is someone with advanced scripting abilities it will proceed much faster.

sethkha 2011-05-27 12:45

Re: gpodder - local folder as podcast
 
In case someone needs it.
With this script you can add a folder (with mp3) to gpodder as a podcast. It creates a foldername.xml. Add it with file:///path/to/foldername.xml
Zenity should be installed.

Code:

#!/bin/sh
pod_dir=$(zenity --file-selection --directory)
pod_title=$(basename "$pod_dir")

echo '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>'$pod_title '</title>'>$pod_title.xml

for file in "$pod_dir"/*.mp3
do
file_title=$(basename "$file")
file_length=$(stat "$file" | grep Size | awk '{print $2}')
echo '<item>
<title>'$file_title'</title>
<enclosure url="file://'$file'" length="'$file_length'" type="audio/mpeg"/>
</item>'>>$pod_title.xml
done

echo '</channel>
</rss>'>>$pod_title.xml


mmarks 2011-06-17 07:20

Re: gpodder - local folder as podcast
 
Hi there,

This looks like exactly what I need - I downloaded podcasts onto my PC and then copied the folders over to my N900 and want to use them with gpodder.
Trouble is, I don't really understand your solution.
Please could you explain exactly what I need to do so that gpodder includes this folder (and hopefully subfolders)?

thanks,

Mike

sethkha 2011-06-17 07:51

Re: gpodder - local folder as podcast
 
hi
- make sure zenity is installed, otherwise install.
- create a localfeed.sh in your home directory and copy/paste the code above.
- make it executable
- run it with ./localfeed.sh
- choose a folder
- run gpodder and add new podcast -> Podcast feed/website URL
- type: file:///home/user/FOLDERNAME.xml
(FOLDERNAME is the name of the folder with the mp3)

It doesn't add subfolders and has no other convenience functions. Maybe some day.

mmarks 2011-06-17 08:30

Re: gpodder - local folder as podcast
 
Thanks so much for the quick reply.

I installed zenity 2.28.0-1maemo0 and zenity-gdialog 2.28.0-1maemo0.

Then I created a script in notepad on my PC called localfeed.sh and did a copy/paste of your script into it.
Copied and pasted the script to /home/user
used the command chmod +x localfeed.sh

When I type in ./localfeed.sh I get the response /bin/sh: ./localfeed.sh: not found

If I type in cat localfeed.sh it shows me the script so it is there!

What have I done wrong?

sethkha 2011-06-17 08:45

Re: gpodder - local folder as podcast
 
seems to me you've done alright.
a few thoughts:
- when you type ls . Is it REALLY there (green)?
- try sh ./localfeed.sh
- maybe it's because I have bash installed. Do you have problems running other scripts?

mmarks 2011-06-17 08:50

Re: gpodder - local folder as podcast
 
I did have a problem with another script (not my expertise so I gave up and typed the commands in one by one on that script!)

Can I just install bash and try again?

sethkha 2011-06-17 09:11

Re: gpodder - local folder as podcast
 
- if it's windows notepad, maybe that's the problem?
- I think the necessary things are installed by default, but I would install bash, gnu-tools... if I were you. It's difficult to recommend this, as I don't know where the problem is, or if you could run into other problems. A look through available packages could be helpful anyway.

mmarks 2011-06-17 09:47

Re: gpodder - local folder as podcast
 
Thanks sethka, this is all new to me and I am still at the stage where I copy and paste in the hope it works! If it doesn't then I am stuck!
I did have a problem previously running a script (only other one I have tried) in that it came up with errors on just about every line. It didn't recongnise do statements etc. never found out why, I just typed the commands in terminal and did it manually. It worked for that but I couldn't type in 100's of podcasts manually for gpodder to see them.
If you do have any other ideas, would love to try them.

sethkha 2011-06-17 10:04

Re: gpodder - local folder as podcast
 
1. Does ls give you the expected output?
2. if you copy/pasted this with windows notepad: Copy/paste it into n900 notes and save as...
3. If it's still not working or you used a linux machine, install bash (any version).
4. Give me feedback for every point


All times are GMT. The time now is 20:22.

vBulletin® Version 3.8.8