Skip to content

Commit 2df75ec

Browse files
committed
22.4
1 parent dad16e0 commit 2df75ec

4 files changed

Lines changed: 26 additions & 45 deletions

File tree

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
project('helia', 'c', version: '22.2', meson_version: '>= 0.50.0', default_options: ['warning_level=2', 'c_std=gnu11'])
1+
project('helia', 'c', version: '22.4', meson_version: '>= 0.50.0', default_options: ['warning_level=2', 'c_std=gnu11'])
22

33
cc = meson.get_compiler('c')
44

src/helia-win.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static void helia_about ( GtkWindow *window )
143143
gtk_about_dialog_set_authors ( dialog, authors );
144144
gtk_about_dialog_set_artists ( dialog, artists );
145145
gtk_about_dialog_set_program_name ( dialog, "Helia" );
146-
gtk_about_dialog_set_logo_icon_name ( dialog, DEF_ICON );
146+
gtk_about_dialog_set_logo_icon_name ( dialog, "helia-logo" );
147147
gtk_about_dialog_set_license_type ( dialog, GTK_LICENSE_GPL_3_0 );
148148
gtk_about_dialog_set_copyright ( dialog, "Copyright 2022 Helia" );
149149
gtk_about_dialog_set_website ( dialog, "https://github.com/vl-nix/helia" );

src/player.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static void player_record ( Player *player )
662662
gboolean hls = FALSE;
663663
if ( uri && g_strrstr ( uri, ".m3u8" ) ) hls = TRUE;
664664

665-
double volume = VOLUME;
665+
double volume = 0.75;
666666
g_object_get ( player->playbin, "volume", &volume, NULL );
667667

668668
player_set_stop ( player );

src/tree-view.c

Lines changed: 23 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ static void tree_view_to_file ( const char *file, gboolean mp_tv, GtkTreeView *t
3434
if ( ind == 0 ) return;
3535

3636
gboolean valid;
37-
for ( valid = gtk_tree_model_get_iter_first ( model, &iter ); valid;
38-
valid = gtk_tree_model_iter_next ( model, &iter ) )
37+
for ( valid = gtk_tree_model_get_iter_first ( model, &iter ); valid; valid = gtk_tree_model_iter_next ( model, &iter ) )
3938
{
4039
char *name = NULL;
4140
char *data = NULL;
@@ -141,6 +140,9 @@ static gboolean tree_view_media_filter ( const char *file_name, gboolean m3u )
141140

142141
static void tree_view_add_m3u ( const char *file, GtkTreeView *treeview )
143142
{
143+
char *title = NULL;
144+
gboolean found = FALSE;
145+
144146
char *contents = NULL;
145147
GError *err = NULL;
146148

@@ -149,33 +151,27 @@ static void tree_view_add_m3u ( const char *file, GtkTreeView *treeview )
149151
char **lines = g_strsplit ( contents, "\n", 0 );
150152

151153
uint i = 0; for ( i = 0; lines[i] != NULL; i++ )
152-
//for ( i = 0; lines[i] != NULL && *lines[i]; i++ )
153154
{
154-
if ( g_str_has_prefix ( lines[i], "#EXTM3U" ) || g_str_has_prefix ( lines[i], " " ) || strlen ( lines[i] ) < 4 ) continue;
155-
156-
if ( g_str_has_prefix ( lines[i], "#EXTINF" ) )
157-
{
158-
char **lines_info = g_strsplit ( lines[i], ",", 0 );
155+
if ( g_str_has_prefix ( lines[i], "#EXTM3U" ) || strlen ( lines[i] ) < 4 ) continue;
156+
if ( g_str_has_prefix ( lines[i], "#EXTGRP" ) || g_str_has_prefix ( lines[i], "#EXTVLCOPT" ) ) continue;
159157

160-
if ( g_str_has_prefix ( lines[i+1], "#EXTGRP" ) ) i++;
158+
if ( found ) { tree_view_append ( title, g_strstrip ( lines[i] ), treeview ); found = FALSE; }
161159

162-
tree_view_append ( g_strstrip ( lines_info[1] ), g_strstrip ( lines[i+1] ), treeview );
163-
164-
g_strfreev ( lines_info );
165-
i++;
166-
}
167-
else
160+
if ( g_str_has_prefix ( lines[i], "#EXTINF" ) )
168161
{
169-
if ( g_str_has_prefix ( lines[i], "#" ) || g_str_has_prefix ( lines[i], " " ) || strlen ( lines[i] ) < 4 ) continue;
162+
char **line = g_strsplit ( lines[i], ",", 0 );
170163

171-
char *name = g_path_get_basename ( lines[i] );
164+
if ( title ) free ( title );
165+
title = g_strdup ( g_strstrip ( line[1] ) );
172166

173-
tree_view_append ( g_strstrip ( name ), g_strstrip ( lines[i] ), treeview );
167+
g_strfreev ( line );
174168

175-
free ( name );
169+
found = TRUE;
176170
}
177171
}
178172

173+
if ( title ) free ( title );
174+
179175
g_strfreev ( lines );
180176
free ( contents );
181177
}
@@ -454,15 +450,15 @@ static void treeview_handler_append ( TreeView *treeview, const char *name, cons
454450
static char * treeview_handler_next ( TreeView *treeview, const char *uri, uint num )
455451
{
456452
char *path = NULL;
453+
g_autofree char *next = ( uri ) ? helia_uri_get_path ( uri ) : NULL;
457454

458455
GtkTreeModel *model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( treeview ) );
459456

460457
uint count = 0;
461458
GtkTreeIter iter;
462-
gboolean valid, break_f = FALSE;
459+
gboolean valid, found = FALSE, break_f = FALSE;
463460

464-
for ( valid = gtk_tree_model_get_iter_first ( model, &iter ); valid;
465-
valid = gtk_tree_model_iter_next ( model, &iter ) )
461+
for ( valid = gtk_tree_model_get_iter_first ( model, &iter ); valid; valid = gtk_tree_model_iter_next ( model, &iter ) )
466462
{
467463
char *data = NULL;
468464
gtk_tree_model_get ( model, &iter, COL_DATA, &data, -1 );
@@ -472,40 +468,25 @@ static char * treeview_handler_next ( TreeView *treeview, const char *uri, uint
472468
if ( count == num )
473469
{
474470
path = g_strdup ( data );
475-
gtk_tree_selection_select_iter ( gtk_tree_view_get_selection ( GTK_TREE_VIEW ( treeview ) ), &iter );
476471

477472
break_f = TRUE;
478473
}
479474
}
480475
else
481476
{
482-
char *next = helia_uri_get_path ( uri );
477+
if ( found ) { path = g_strdup ( data ); break_f = TRUE; }
483478

484-
if ( g_strrstr ( next, data ) )
485-
{
486-
if ( gtk_tree_model_iter_next ( model, &iter ) )
487-
{
488-
char *data2 = NULL;
489-
gtk_tree_model_get ( model, &iter, COL_DATA, &data2, -1 );
490-
491-
path = g_strdup ( data2 );
492-
493-
gtk_tree_selection_select_iter ( gtk_tree_view_get_selection ( GTK_TREE_VIEW ( treeview ) ), &iter );
494-
free ( data2 );
495-
496-
}
497-
498-
break_f = TRUE;
499-
}
500-
501-
free ( next );
479+
if ( next && g_strrstr ( next, data ) ) found = TRUE;
502480
}
503481

504482
count++;
505483
free ( data );
484+
506485
if ( break_f ) break;
507486
}
508487

488+
if ( break_f ) gtk_tree_selection_select_iter ( gtk_tree_view_get_selection ( GTK_TREE_VIEW ( treeview ) ), &iter );
489+
509490
return path;
510491
}
511492

0 commit comments

Comments
 (0)