Skip to content

Track download fails for items of channel

If I try downloading an item of a channel the download fails due to album-tag missing:

# ./funkwhale -H $server tracks download 184003 -t "{title}.{extension}" 
  0%|                                                                                                                       | 0/1 [00:00<?, ?Files/s]
Downloading from $url
  0%|                                                                                                                       | 0/1 [00:00<?, ?Files/s]
Traceback (most recent call last):                                                                                                                   
  File "/home/david/.local/bin/./funkwhale", line 8, in <module>                                                                                     
    sys.exit(cli())                                                                                                                                  
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1137, in __call__                                                                      
    return self.main(*args, **kwargs)                                                                                                                
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1062, in main                                                                          
    rv = self.invoke(ctx)                                                                                                                            
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1668, in invoke                                                                        
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                          
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1668, in invoke                                                                        
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                          
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1404, in invoke                                                                        
    return ctx.invoke(self.callback, **ctx.params)                                                                                                   
  File "/usr/lib/python3.9/site-packages/click/core.py", line 763, in invoke                                                                         
    return __callback(*args, **kwargs)                                                                                                               
  File "/usr/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func                                                                  
    return f(get_current_context(), *args, **kwargs)                                                                                                 
  File "/home/david/.local/lib/python3.9/site-packages/funkwhale_cli/cli/base.py", line 117, in wrapper                                              
    return loop.run_until_complete(f(*args, **kwargs))                                                                                               
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete                                                                  
    return future.result()                                                                                                                           
  File "/home/david/.local/lib/python3.9/site-packages/funkwhale_cli/cli/tracks.py", line 82, in track_download                                      
    filename_params["album"] = filename_params["album_title"]                                                                                        
KeyError: 'album_title'                                                                                                                              

For this to work, we probably need to ignore missing keys (and replace them e.g. with None).

I checked the JSON of this track directly and it's only missing the album (that being null), other tags like title, position and artist are there.