https://bugs.gpodder.org/show_bug.cgi?id=1319
Bug #: 1319
Summary: on_episode_downloaded hook
Classification: Unclassified
Product: gPodder
Version: unspecified
Platform: PC
OS/Version: Linux
Status: UNCONFIRMED
Severity: minor
Priority: low
Component: Application
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Hi,
I need a new hook when the file is downloaded, because I need to access to the
database information.
I wrote a question in the mailling list I this is the response:
- - - -
http://www.mail-archive.com/[email protected]/msg02253.html
Hi Rodolfo,
On Thu, Mar 31, 2011 at 05:26:13AM -0700, Rodolfo kix Garcia wrote:
> I have some podcasts without id3 info. When the podcast are copied to my
> device, I don't have any information about it, then the device show only
> the filename (a long number like 764261212341766.mp3).
> [...]
> Then I try to write a hook using "on_episode_save", but the hook is called
> before the file is saved, then, I cannot rewrite the ID3 info (the file
> don't exists yet).
>
> I try to write other hook using "on_file_copied_to_filesystem", but I only
> have the file names (origin, destination), then I cannot access to the
> database to get the info for the ID3 (or I don't know how to do it).
>
> Any help?
So basically what you would need is a new hook that gets called when the
episode has finished downloading and the downloaded file has been saved
and the filename is known, right? If so, can you please open a feature
request for that on http://bugs.gpodder.org? :)
Thanks,
Thomas
- - - -
This can be a patch
(http://kix.es/src/gpodder/on_episode_downloaded_hook.patch):
- - - -
--- hooks.py.orig 2011-04-01 18:04:09.000000000 +0200
+++ hooks.py 2011-04-01 18:04:09.000000000 +0200
@@ -140,4 +140,14 @@
"""
pass
+ @call_hooks
+ def on_episode_downloaded(self, episode):
+ """Called after an episode is downloaded
+
+ This hook will be called when a new episode is downloaded
+ to the disk.
+
+ @param episode: A gpodder.model.PodcastEpisode instance
+ """
+ pass
--- model.py.orig 2011-04-01 18:04:21.000000000 +0200
+++ model.py 2011-04-01 18:04:21.000000000 +0200
@@ -863,6 +863,10 @@
self.total_time = length
self.db.save_episode(self)
self.db.commit()
+
+ if gpodder.user_hooks is not None:
+ gpodder.user_hooks.on_episode_downloaded(self)
+
return
except Exception, e:
log('Error while detecting media length: %s', str(e), \
@@ -871,6 +875,9 @@
self.db.save_downloaded_episode(self)
self.db.commit()
+ if gpodder.user_hooks is not None:
+ gpodder.user_hooks.on_episode_downloaded(self)
+
def set_state(self, state):
self.state = state
self.db.update_episode_state(self)
- - - -
Thanks a lot.
--
Configure bugmail: https://bugs.gpodder.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
_______________________________________________
gPodder-Bugs mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/gpodder-bugs