@@ -2939,7 +2939,7 @@ def update_artist_info(self, filter_id):
29392939 return False
29402940 return self .return_data (ampache_response )
29412941
2942- def stream (self , object_id , object_type , destination ):
2942+ def stream (self , object_id , object_type , destination , stats = 1 ):
29432943 """ stream
29442944 MINIMUM_API_VERSION=400001
29452945
@@ -2956,15 +2956,16 @@ def stream(self, object_id, object_type, destination):
29562956 data = {'action' : 'stream' ,
29572957 'auth' : self .AMPACHE_SESSION ,
29582958 'id' : object_id ,
2959- 'type' : object_type }
2959+ 'type' : object_type ,
2960+ 'stats' : stats }
29602961 data = urllib .parse .urlencode (data )
29612962 full_url = ampache_url + '?' + data
29622963 result = requests .get (full_url , allow_redirects = True )
29632964 open (destination , 'wb' ).write (result .content )
29642965 return True
29652966
29662967 def download (self , object_id , object_type , destination ,
2967- transcode = 'raw' , bitrate = False ):
2968+ transcode = 'raw' , bitrate = False , stats = 1 ):
29682969 """ download
29692970 MINIMUM_API_VERSION=400001
29702971
@@ -2984,7 +2985,8 @@ def download(self, object_id, object_type, destination,
29842985 'id' : object_id ,
29852986 'type' : object_type ,
29862987 'format' : transcode ,
2987- 'bitrate' : bitrate }
2988+ 'bitrate' : bitrate ,
2989+ 'stats' : stats }
29882990 if not bitrate :
29892991 data .pop ('bitrate' )
29902992 data = urllib .parse .urlencode (data )
@@ -4286,7 +4288,9 @@ def execute(self, method: str, params=None):
42864288 params ["transcode" ] = 'raw'
42874289 if not "bitrate" in params :
42884290 params ["bitrate" ] = False
4289- return self .download (params ["object_id" ], params ["object_type" ], params ["destination" ])
4291+ if not "stats" in params :
4292+ params ["stats" ] = 1
4293+ return self .download (params ["object_id" ], params ["object_type" ], params ["destination" ], params ["stats" ])
42904294 case 'flag' :
42914295 if not "date" in params :
42924296 params ["date" ] = False
@@ -4698,7 +4702,9 @@ def execute(self, method: str, params=None):
46984702 return self .stats (params ["object_type" ], params ["filter_str" ], params ["username" ],
46994703 params ["user_id" ], params ["offset" ], params ["limit" ])
47004704 case 'stream' :
4701- return self .stream (params ["object_id" ], params ["object_type" ], params ["destination" ])
4705+ if not "stats" in params :
4706+ params ["stats" ] = 1
4707+ return self .stream (params ["object_id" ], params ["object_type" ], params ["destination" ], params ["stats" ])
47024708 case 'system_preference' :
47034709 return self .system_preference (params ["filter_str" ])
47044710 case 'system_preferences' :
0 commit comments