Commit a06f46ed authored by Felix Paul Kühne's avatar Felix Paul Kühne

podcasts SD: fix variable handling and minor cleanup (close #8947)

parent e69b8587
...@@ -222,14 +222,13 @@ static void *Run( void *data ) ...@@ -222,14 +222,13 @@ static void *Run( void *data )
if( p_sys->update_type == UPDATE_URLS ) if( p_sys->update_type == UPDATE_URLS )
{ {
char* psz_urls = var_GetNonEmptyString( p_sd, "podcast-urls" ); playlist_t *pl = pl_Get( p_sd );
char* psz_urls = var_GetNonEmptyString( pl, "podcast-urls" );
ParseUrls( p_sd, psz_urls ); ParseUrls( p_sd, psz_urls );
free( psz_urls ); free( psz_urls );
} }
else if( p_sys->update_type == UPDATE_REQUEST ) else if( p_sys->update_type == UPDATE_REQUEST )
{
ParseRequest( p_sd ); ParseRequest( p_sd );
}
p_sys->b_update = false; p_sys->b_update = false;
...@@ -303,7 +302,8 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls ) ...@@ -303,7 +302,8 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls )
for( ;; ) for( ;; )
{ {
if( !psz_urls ) break; if( !psz_urls )
break;
char *psz_tok = strchr( psz_urls, '|' ); char *psz_tok = strchr( psz_urls, '|' );
if( psz_tok ) *psz_tok = '\0'; if( psz_tok ) *psz_tok = '\0';
...@@ -332,8 +332,10 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls ) ...@@ -332,8 +332,10 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls )
strdup( p_sys->ppsz_urls[i]) ); strdup( p_sys->ppsz_urls[i]) );
INSERT_ELEM( pp_new_items, i_new_items, i_new_items, p_sys->pp_items[i] ); INSERT_ELEM( pp_new_items, i_new_items, i_new_items, p_sys->pp_items[i] );
} }
if( psz_tok ) psz_urls = psz_tok+1; if( psz_tok )
else break; psz_urls = psz_tok+1;
else
break;
} }
/* delete removed items and signal the removal */ /* delete removed items and signal the removal */
...@@ -348,7 +350,8 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls ) ...@@ -348,7 +350,8 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls )
} }
} }
free( p_sys->pp_items ); free( p_sys->pp_items );
for( int i = 0; i < p_sys->i_urls; i++ ) free( p_sys->ppsz_urls[i] ); for( int i = 0; i < p_sys->i_urls; i++ )
free( p_sys->ppsz_urls[i] );
free( p_sys->ppsz_urls ); free( p_sys->ppsz_urls );
p_sys->ppsz_urls = ppsz_new_urls; p_sys->ppsz_urls = ppsz_new_urls;
...@@ -371,7 +374,8 @@ static void ParseRequest( services_discovery_t *p_sd ) ...@@ -371,7 +374,8 @@ static void ParseRequest( services_discovery_t *p_sd )
if ( ! p_sys->b_savedurls_loaded ) if ( ! p_sys->b_savedurls_loaded )
{ {
char* psz_urls = var_GetNonEmptyString( p_sd, "podcast-urls" ); playlist_t *pl = pl_Get( p_sd );
char* psz_urls = var_GetNonEmptyString( pl, "podcast-urls" );
ParseUrls( p_sd, psz_urls ); ParseUrls( p_sd, psz_urls );
free( psz_urls ); free( psz_urls );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment