Skip to content

Commit

Permalink
Correct ffmpeg/avconv extensions for Windows (bug 1773)
Browse files Browse the repository at this point in the history
On Windows systems the command-name includes the extension .exe
When reading the dictionary for the right command parameters we
have to remove the extension to find the correct entry

Also remove a false variable name (e instead of episode)
  • Loading branch information
brot authored and thp committed Feb 19, 2013
1 parent 00f80f7 commit 93668b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions share/gpodder/extensions/m4a_converter.py
Expand Up @@ -43,7 +43,10 @@ def __init__(self, container):

# Dependency checks
self.command = self.container.require_any_command(['avconv', 'ffmpeg'])
self.command_param = self.CMD[os.path.basename(self.command)]

# extract command without extension (.exe on Windows) from command-string
command_without_ext = os.path.basename(os.path.splitext(self.command)[0])
self.command_param = self.CMD[command_without_ext]

def on_episode_downloaded(self, episode):
self._convert_episode(episode)
Expand All @@ -65,7 +68,7 @@ def on_episodes_context_menu(self, episodes):
if not all(e.was_downloaded(and_exists=True) for e in episodes):
return None

if not any(self._check_mp4(episode) for e in episodes):
if not any(self._check_mp4(episode) for episode in episodes):
return None

target_format = ('OGG' if self.config.use_ogg else 'MP3')
Expand Down Expand Up @@ -107,4 +110,3 @@ def _convert_episode(self, episode):
def _convert_episodes(self, episodes):
for episode in episodes:
self._convert_episode(episode)

5 changes: 4 additions & 1 deletion share/gpodder/extensions/ogg2mp3_converter.py
Expand Up @@ -42,7 +42,10 @@ def __init__(self, container):

# Dependency checks
self.command = self.container.require_any_command(['avconv', 'ffmpeg'])
self.command_param = self.CMD[os.path.basename(self.command)]

# extract command without extension (.exe on Windows) from command-string
command_without_ext = os.path.basename(os.path.splitext(self.command)[0])
self.command_param = self.CMD[command_without_ext]

def on_episode_downloaded(self, episode):
self.convert_episode(episode)
Expand Down

0 comments on commit 93668b6

Please sign in to comment.