remove id3 dep; malvim qol
some clippy cleanup
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ming-wm"
|
||||
version = "1.3.0-rc.0"
|
||||
version = "1.3.0-rc.1"
|
||||
repository = "https://github.com/stjet/ming-wm"
|
||||
license = "GPL-3.0-or-later"
|
||||
edition = "2021"
|
||||
@@ -34,14 +34,13 @@ ming-wm-lib = { path = "ming-wm-lib" }
|
||||
wm = { path = "wm", optional = true }
|
||||
linux = { path = "linux", optional = true }
|
||||
rodio = { version = "0.19.0", default-features = false, features = [ "flac", "mp3", "symphonia-vorbis", "wav" ], optional = true }
|
||||
id3 = { version = "1.10.0", optional = true }
|
||||
mp4ameta = { version = "0.11.0", optional = true }
|
||||
metaflac = { version = "0.2.5", optional = true }
|
||||
|
||||
[features]
|
||||
default = [ "wm", "terminal" ]
|
||||
terminal = [ "linux" ]
|
||||
audio_player = [ "id3", "mp4ameta", "metaflac", "rodio" ]
|
||||
audio_player = [ "mp4ameta", "metaflac", "rodio" ]
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
||||
BIN
bmps/shippori-mincho/死0.bmp
Normal file
BIN
bmps/shippori-mincho/死0.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 630 B |
BIN
bmps/shippori-mincho/話0.bmp
Normal file
BIN
bmps/shippori-mincho/話0.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 630 B |
BIN
bmps/shippori-mincho/離0.bmp
Normal file
BIN
bmps/shippori-mincho/離0.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 630 B |
@@ -16,6 +16,10 @@ Tab completion is supported for the `<dir>` and `<dir / playlist file>` argument
|
||||
|
||||
The copy shortcut will copy the currently playing song's file name, if there is a currently playing song.
|
||||
|
||||
## Artist Name
|
||||
|
||||
For mp3, artist name shows up only if there is an id3v1 tag present. For flac and mp4, the built-in metadata system should be supported.
|
||||
|
||||
## Playlists
|
||||
|
||||
Example playlist file:
|
||||
|
||||
@@ -24,14 +24,14 @@ Tab completion is supported for the `<file>` argument. Down arrow will clear the
|
||||
- `A`
|
||||
- `r`
|
||||
- `dd`
|
||||
- `<number>dd`
|
||||
- `<num>dd`
|
||||
- `dw` (`dw` is not identical to vim's behaviour), `dW`
|
||||
- `d$`
|
||||
- `G`
|
||||
- `gg`
|
||||
- `<number>gg`
|
||||
- `<num>gg`
|
||||
- `f<char>`, `F<char>`
|
||||
- `<number>f<char>`, `<number>F<char>`
|
||||
- `<num>f<char>`, `<num>F<char>`
|
||||
- `;` (same as `f<char>` but with the char the cursor is on, so not the same as vim)
|
||||
- `<num>;`
|
||||
- `,` (same as `F<char>` but with the char the cursor is on, so not the same as vim)
|
||||
@@ -45,3 +45,7 @@ Tab completion is supported for the `<file>` argument. Down arrow will clear the
|
||||
### Malvim Specific
|
||||
|
||||
In Command-line Mode, `autoindent` can be done to toggle auto-indenting (when making new line in Insert Mode [ie, by hitting Enter/Return], space indentation of the new line will be the same as the space indentation of the current line). **Toggling on `autoindent` is highly recommended when editing code.**
|
||||
|
||||
- `>` indent two spaces
|
||||
- `<num>>` indent variable amount of spaces
|
||||
- `<num>Alt+C` copy variable amount of lines to clipboard (if no number, defaults to only the current line)
|
||||
|
||||
@@ -289,11 +289,7 @@ impl Serializable for DrawInstructions {
|
||||
"N" => None,
|
||||
_ => {
|
||||
if arg.len() > 1 {
|
||||
if let Ok(n) = arg[1..].parse() {
|
||||
Some(n)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
arg[1..].parse().ok()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@@ -308,11 +304,7 @@ impl Serializable for DrawInstructions {
|
||||
"N" => None,
|
||||
_ => {
|
||||
if arg.len() > 1 {
|
||||
if let Ok(n) = arg[1..].parse() {
|
||||
Some(n)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
arg[1..].parse().ok()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ use std::vec;
|
||||
use std::io::BufReader;
|
||||
use std::path::PathBuf;
|
||||
use std::collections::HashMap;
|
||||
use std::io::Read;
|
||||
use std::io::{ Read, Seek };
|
||||
use std::time::Duration;
|
||||
use std::fs::{ read_to_string, File };
|
||||
use std::thread;
|
||||
use std::sync::{ Arc, Mutex };
|
||||
|
||||
use rodio::{ Decoder, OutputStream, Sink, Source };
|
||||
use id3::TagLike;
|
||||
//use id3::TagLike;
|
||||
use mp4ameta;
|
||||
use metaflac;
|
||||
|
||||
@@ -37,8 +37,27 @@ fn get_artist(path: &PathBuf) -> Option<String> {
|
||||
};
|
||||
x
|
||||
} else if ext == "mp3" {
|
||||
let tag = id3::Tag::read_from_path(path).unwrap();
|
||||
tag.artist().map(|s| s.to_string())
|
||||
//let tag = id3::Tag::read_from_path(path).unwrap();
|
||||
//tag.artist().map(|s| s.to_string())
|
||||
//read id3v1 tag at end of file
|
||||
let mut tag = File::open(path).unwrap();
|
||||
tag.seek(std::io::SeekFrom::End(-128)).unwrap();
|
||||
let mut tag_constant = vec![0; 3];
|
||||
tag.read_exact(&mut tag_constant).unwrap();
|
||||
//look for "TAG"
|
||||
if tag_constant == vec![84, 65, 71] {
|
||||
//first 30 chars are title, next 30 are artist, then next 30 are album
|
||||
tag.seek_relative(30).unwrap();
|
||||
let mut artist = vec![0; 30];
|
||||
tag.read_exact(&mut artist).unwrap();
|
||||
//I hope stackoverflow doesn't die
|
||||
if let Some(first) = artist.iter().position(|b| *b == 0) {
|
||||
artist.truncate(first);
|
||||
}
|
||||
Some(String::from_utf8(artist).unwrap_or_default())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -117,16 +117,8 @@ impl WindowLike for Draw {
|
||||
DrawAction::Line(p, _, u, r) => DrawAction::Line(*p, Some(self.current_location), *u, *r),
|
||||
DrawAction::Rect(p, _, r) => {
|
||||
let d = [
|
||||
if self.current_location[0] > p[0] {
|
||||
self.current_location[0] - p[0]
|
||||
} else {
|
||||
p[0] - self.current_location[0]
|
||||
},
|
||||
if self.current_location[1] > p[1] {
|
||||
self.current_location[1] - p[1]
|
||||
} else {
|
||||
p[1] - self.current_location[1]
|
||||
}
|
||||
self.current_location[0].abs_diff(p[0]),
|
||||
self.current_location[1].abs_diff(p[1]),
|
||||
];
|
||||
//find top left corner
|
||||
let tl = [
|
||||
|
||||
@@ -191,7 +191,7 @@ impl FileExplorer {
|
||||
//should include .. if not /
|
||||
fn get_current_dir_contents(&self) -> Vec<DirectoryChild> {
|
||||
let mut contents = Vec::new();
|
||||
if self.current_path != PathBuf::from("/") {
|
||||
if *self.current_path != *"/" {
|
||||
contents.push(DirectoryChild {
|
||||
override_name: Some("..".to_string()),
|
||||
is_file: false,
|
||||
|
||||
@@ -278,6 +278,11 @@ impl WindowLike for Malvim {
|
||||
} else {
|
||||
changed = false;
|
||||
}
|
||||
} else if key_press.key == '>' {
|
||||
let num = self.maybe_num.unwrap_or(2);
|
||||
let line = ¤t_file.content[current_file.line_pos];
|
||||
current_file.content[current_file.line_pos] = " ".repeat(num) + line;
|
||||
current_file.cursor_pos += num;
|
||||
} else if key_press.key == 'h' || key_press.is_left_arrow() {
|
||||
current_file.cursor_pos = current_file.cursor_pos.checked_sub(self.maybe_num.unwrap_or(1)).unwrap_or(0);
|
||||
changed = false;
|
||||
@@ -485,7 +490,18 @@ impl WindowLike for Malvim {
|
||||
ShortcutType::ClipboardCopy => {
|
||||
if self.files.len() > 0 {
|
||||
let current_file = &mut self.files[self.current_file_index];
|
||||
WindowMessageResponse::Request(WindowManagerRequest::ClipboardCopy(current_file.content[current_file.line_pos].clone()))
|
||||
let line_count = self.maybe_num.unwrap_or(1);
|
||||
let mut copy_lines = String::new();
|
||||
for i in 0..line_count {
|
||||
if current_file.content.len() == self.current_file_index + i {
|
||||
break;
|
||||
}
|
||||
if !copy_lines.is_empty() {
|
||||
copy_lines += "\n";
|
||||
}
|
||||
copy_lines += ¤t_file.content[current_file.line_pos + i];
|
||||
}
|
||||
WindowMessageResponse::Request(WindowManagerRequest::ClipboardCopy(copy_lines))
|
||||
} else {
|
||||
WindowMessageResponse::DoNothing
|
||||
}
|
||||
|
||||
@@ -721,7 +721,7 @@ impl WindowManager {
|
||||
self.writer.borrow_mut().write_saved_buffer_to_raw();
|
||||
}
|
||||
//get windows to redraw
|
||||
let redraw_ids = maybe_redraw_ids.unwrap_or(Vec::new());
|
||||
let redraw_ids = maybe_redraw_ids.unwrap_or_default();
|
||||
let mut all_in_workspace = self.get_windows_in_workspace(true);
|
||||
if let Some(osk) = &self.osk {
|
||||
all_in_workspace.push(osk);
|
||||
|
||||
Reference in New Issue
Block a user