Jump to content

here is a python script (linux) for ripping pandora


Recommended Posts

i found this on the net, and now i cannot found where i got it to give proper credit, but i didnt see it here

i want to make clear that i DID NOT make this, and I only post it in the hopes someone might improve it a tad..such as adding the mp4 extension to the files when they get moved and etc.

at the moment it just locks the files in /tmp so flash cant remove them, then it moves it into a folder inside your home named pandora

hopefully a python guru will come along and perfect this as it takes no tricks or flash switching to run

it wont let me upload so i guess ill post it here

--------------------start under here-----------------------------


import os

import pyinotify

import fcntl

from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, ProcessEvent





wm = WatchManager()

#mask = EventsCodes.IN_DELETE | EventsCodes.IN_CREATE # watched events

mask = EventsCodes.ALL_EVENTS

class PTmp(ProcessEvent):


# def process_IN_CREATE(self, event):

# print "Create: %s" % os.path.join(event.path, event.name)

# def process_IN_DELETE(self, event):

# print "Remove: %s" % os.path.join(event.path, event.name)

def process_default(self, event):

# print "Processing Some event?"

if event.name.startswith("Flash"):

print event


if event.event_name=="IN_CREATE":

self.f[filename]=file(filename, mode="r")

fcntl.lockf(self.f[filename], fcntl.LOCK_SH)

if event.event_name.startswith("IN_DELETE") and self.f.has_key(filename):

print "DELETING"



# if len(buf)>100: # 100 bytes

# file("100dump",mode="a").write(buf[:100].encode("hex")+"\n")



fcntl.lockf(self.f[filename], fcntl.LOCK_UN)

if os.access(filename, os.R_OK):


notifier = Notifier(wm, PTmp())

wdd = wm.add_watch('/tmp', mask, rec=True)

while True: # loop forever


# process the queue of events as explained above


if notifier.check_events():

# read notified events and enqeue them


# you can do some tasks here...

except KeyboardInterrupt:

# destroy the inotify's instance on this interrupt (stop monitoring)


------------end on line above-------

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...