@@ -19,8 +19,6 @@ use crate::ui::audiofeatures::{AudioFeaturesConfig, AudioFeatures};
19
19
use crate :: ui:: tageditor:: TagEditor ;
20
20
use crate :: playlist:: UIPlaylist ;
21
21
22
- const VERSION : & ' static str = env ! ( "CARGO_PKG_VERSION" ) ;
23
-
24
22
//Wrap of tagger config, so playlists can be passed too
25
23
#[ derive( Debug , Clone , Serialize , Deserialize ) ]
26
24
struct TaggerConfigWrap {
@@ -43,6 +41,22 @@ enum TaggerConfigs {
43
41
AudioFeatures ( AudioFeaturesConfig )
44
42
}
45
43
44
+ impl TaggerConfigs {
45
+ //Print to log for later easier debug
46
+ pub fn debug_print ( & self ) {
47
+ match self {
48
+ TaggerConfigs :: AutoTagger ( c) => {
49
+ let mut c = c. clone ( ) ;
50
+ c. discogs . token = None ;
51
+ info ! ( "AutoTagger config: {:?}" , c) ;
52
+ } ,
53
+ TaggerConfigs :: AudioFeatures ( c) => {
54
+ info ! ( "AudioFeatures Config: {:?}" , c) ;
55
+ }
56
+ }
57
+ }
58
+ }
59
+
46
60
//Shared variables in socket
47
61
struct SocketContext {
48
62
player : AudioPlayer ,
@@ -112,7 +126,7 @@ fn handle_message(text: &str, websocket: &mut WebSocket<TcpStream>, context: &mu
112
126
"init" => {
113
127
websocket. write_message ( Message :: from ( json ! ( {
114
128
"action" : "init" ,
115
- "version" : VERSION ,
129
+ "version" : crate :: VERSION ,
116
130
"startContext" : context. start_context
117
131
} ) . to_string ( ) ) ) . ok ( ) ;
118
132
} ,
@@ -138,7 +152,7 @@ fn handle_message(text: &str, websocket: &mut WebSocket<TcpStream>, context: &mu
138
152
//Browse folder
139
153
"browse" => {
140
154
let mut initial = json[ "path" ] . as_str ( ) . unwrap_or ( "." ) ;
141
- if initial. is_empty ( ) {
155
+ if initial. is_empty ( ) || ! Path :: new ( initial ) . exists ( ) {
142
156
initial = "." ;
143
157
}
144
158
if let Some ( path) = tinyfiledialogs:: select_folder_dialog ( "Select path" , initial) {
@@ -165,6 +179,7 @@ fn handle_message(text: &str, websocket: &mut WebSocket<TcpStream>, context: &mu
165
179
let tagger_type = json[ "config" ] [ "type" ] . clone ( ) ;
166
180
let path = json[ "config" ] [ "path" ] . as_str ( ) . unwrap_or ( "" ) . to_string ( ) ;
167
181
let wrap: TaggerConfigWrap = serde_json:: from_value ( json) ?;
182
+ wrap. config . debug_print ( ) ;
168
183
//Get files
169
184
let files = if let Some ( playlist) = wrap. playlist {
170
185
playlist. get_files ( ) ?
0 commit comments