rmptui06da8f0
workaround for #7
+21 −11
2 files changed
- M src/app.rs +17 −8
- M src/browser.rs +4 −3
| @@ -117,10 +117,14 @@ impl App { | |||
| 117 | 117 | let songs = self.conn.conn.listfiles(&file).unwrap_or_default(); | |
| 118 | 118 | for (t, f) in songs.iter() { | |
| 119 | 119 | if t == "file" { | |
| 120 | − | if let Some(full_path) = &self.conn.get_full_path(f) { | |
| 121 | − | let song = self.conn.get_song_with_only_filename(full_path); | |
| 122 | − | self.conn.conn.push(&song)?; | |
| 123 | − | } | |
| 120 | + | let path = self.browser.prev_path.to_string() | |
| 121 | + | + "/" | |
| 122 | + | + self.browser.path.as_str() | |
| 123 | + | + "/" | |
| 124 | + | + f; | |
| 125 | + | let full_path = path.strip_prefix("./").unwrap_or_else(|| ""); | |
| 126 | + | let song = self.conn.get_song_with_only_filename(full_path); | |
| 127 | + | self.conn.conn.push(&song)?; | |
| 124 | 128 | } | |
| 125 | 129 | } | |
| 126 | 130 | } else if content_type == "file" { | |
| @@ -134,10 +138,15 @@ impl App { | |||
| 134 | 138 | } | |
| 135 | 139 | ||
| 136 | 140 | if !status { | |
| 137 | − | if let Some(full_path) = &self.conn.get_full_path(content) { | |
| 138 | − | let song = self.conn.get_song_with_only_filename(full_path); | |
| 139 | − | self.conn.conn.push(&song)?; | |
| 140 | − | } | |
| 141 | + | let path = self.browser.prev_path.to_string() | |
| 142 | + | + "/" | |
| 143 | + | + self.browser.path.as_str() | |
| 144 | + | + "/" | |
| 145 | + | + content; | |
| 146 | + | let full_path = path.strip_prefix("./").unwrap_or_else(|| ""); | |
| 147 | + | ||
| 148 | + | let song = self.conn.get_song_with_only_filename(full_path); | |
| 149 | + | self.conn.conn.push(&song)?; | |
| 141 | 150 | } | |
| 142 | 151 | } | |
| 143 | 152 | ||
| @@ -89,9 +89,10 @@ impl FileBrowser { | |||
| 89 | 89 | let v = conn | |
| 90 | 90 | .conn | |
| 91 | 91 | .lsinfo(Song { | |
| 92 | − | file: conn | |
| 93 | − | .get_full_path(song) | |
| 94 | − | .unwrap_or_else(|| "Not a song".to_string()), | |
| 92 | + | file: (self.path.clone() + "/" + song) | |
| 93 | + | .strip_prefix("./") | |
| 94 | + | .unwrap_or_else(|| "") | |
| 95 | + | .to_string(), | |
| 95 | 96 | ..Default::default() | |
| 96 | 97 | }) | |
| 97 | 98 | .unwrap_or_else(|_| { | |