mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 05:04:17 +01:00
Media: fix code smells
This commit is contained in:
@@ -11,7 +11,7 @@ extern void MRMediaRemoteGetNowPlayingInfo(dispatch_queue_t dispatcher, void(^ca
|
||||
extern void MRMediaRemoteGetNowPlayingClient(dispatch_queue_t dispatcher, void (^callback)(_Nullable id clientObj)) __attribute__((weak_import));
|
||||
extern CFStringRef MRNowPlayingClientGetBundleIdentifier(id clientObj) __attribute__((weak_import));
|
||||
extern CFStringRef MRNowPlayingClientGetParentAppBundleIdentifier(id clientObj) __attribute__((weak_import));
|
||||
void MRMediaRemoteGetNowPlayingApplicationIsPlaying(dispatch_queue_t queue, void (^callback)(BOOL playing));
|
||||
void MRMediaRemoteGetNowPlayingApplicationIsPlaying(dispatch_queue_t queue, void (^callback)(BOOL playing)) __attribute__((weak_import));
|
||||
|
||||
static const char* getMedia(FFMediaResult* result)
|
||||
{
|
||||
@@ -20,6 +20,7 @@ static const char* getMedia(FFMediaResult* result)
|
||||
FF_TEST_FN_EXISTANCE(MRMediaRemoteGetNowPlayingClient);
|
||||
FF_TEST_FN_EXISTANCE(MRNowPlayingClientGetBundleIdentifier);
|
||||
FF_TEST_FN_EXISTANCE(MRNowPlayingClientGetParentAppBundleIdentifier);
|
||||
FF_TEST_FN_EXISTANCE(MRMediaRemoteGetNowPlayingApplicationIsPlaying);
|
||||
#undef FF_TEST_FN_EXISTANCE
|
||||
|
||||
dispatch_group_t group = dispatch_group_create();
|
||||
@@ -63,6 +64,7 @@ static const char* getMedia(FFMediaResult* result)
|
||||
});
|
||||
|
||||
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
|
||||
// Don't dispatch_release because we are using ARC
|
||||
|
||||
if(result->playerId.length > 0)
|
||||
{
|
||||
|
||||
@@ -129,9 +129,9 @@ static bool getBusProperties(FFDBusData* data, const char* busName, FFMediaResul
|
||||
}
|
||||
else
|
||||
{
|
||||
char str[] = { fileName[1], fileName[2], 0 };
|
||||
if (str[0] == 0 || str[1] == 0)
|
||||
if (fileName[1] == 0 || fileName[2] == 0)
|
||||
break;
|
||||
char str[] = { fileName[1], fileName[2], 0 };
|
||||
ffStrbufAppendC(&result->song, (char) strtoul(str, NULL, 16));
|
||||
fileName += 2;
|
||||
}
|
||||
|
||||
@@ -32,15 +32,15 @@ const char* ffWinrtDetectMedia(FFWinrtMediaResult* result)
|
||||
{
|
||||
switch (playbackInfo.PlaybackStatus())
|
||||
{
|
||||
#define FF_MEDIA_SET_STATUS(status_code) \
|
||||
case GlobalSystemMediaTransportControlsSessionPlaybackStatus::status_code: result->status = #status_code; break
|
||||
FF_MEDIA_SET_STATUS(Closed);
|
||||
FF_MEDIA_SET_STATUS(Opened);
|
||||
FF_MEDIA_SET_STATUS(Changing);
|
||||
FF_MEDIA_SET_STATUS(Stopped);
|
||||
FF_MEDIA_SET_STATUS(Playing);
|
||||
FF_MEDIA_SET_STATUS(Paused);
|
||||
#undef FF_MEDIA_SET_STATUS
|
||||
#define FF_MEDIA_SET_STATUS(status_code) \
|
||||
case GlobalSystemMediaTransportControlsSessionPlaybackStatus::status_code: result->status = #status_code; break;
|
||||
FF_MEDIA_SET_STATUS(Closed)
|
||||
FF_MEDIA_SET_STATUS(Opened)
|
||||
FF_MEDIA_SET_STATUS(Changing)
|
||||
FF_MEDIA_SET_STATUS(Stopped)
|
||||
FF_MEDIA_SET_STATUS(Playing)
|
||||
FF_MEDIA_SET_STATUS(Paused)
|
||||
#undef FF_MEDIA_SET_STATUS
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user