mirror of
https://github.com/CDrummond/bliss-analyser.git
synced 2026-10-22 22:32:08 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05532ec6cd | ||
|
|
ee468e723e | ||
|
|
7996d9a525 | ||
|
|
a35140c10e | ||
|
|
2cb17e4dd4 | ||
|
|
e60a3c7b09 | ||
|
|
6f8f3d52a9 | ||
|
|
2771df83db | ||
|
|
c5d3b37f67 |
No files matched your search
@@ -8,7 +8,7 @@ env:
|
||||
|
||||
jobs:
|
||||
Linux:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -99,6 +99,7 @@ jobs:
|
||||
cp UserGuide.md releases/README.md
|
||||
cp LICENSE releases/
|
||||
cp configs/windows.ini releases/config.ini
|
||||
cp c:\Windows\system32\vcruntime140.dll releases
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
|
||||
Generated
+5
-5
@@ -113,7 +113,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bliss-analyser"
|
||||
version = "0.0.1"
|
||||
version = "0.0.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"argparse",
|
||||
@@ -686,9 +686,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lofty"
|
||||
version = "0.5.0"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96b98a3a1ca2f3054b802e5012e5800674d37dc4af7f99f3037fb57af6a2aeaa"
|
||||
checksum = "dfc751ba10f732cf5c522b9bc887027c9eee277512a38a3a0c4f1806bdcd730d"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"byteorder",
|
||||
@@ -889,9 +889,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
|
||||
|
||||
[[package]]
|
||||
name = "ogg_pager"
|
||||
version = "0.3.0"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4507172566b8e1b4d4e3da7f33453055a223fdcf96bc7c5e5d67168f1c4b241b"
|
||||
checksum = "2a846c4c0578b95d4568e6f48210dd6045e7a9572af2b020062d06b6dea049f4"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "bliss-analyser"
|
||||
version = "0.0.1"
|
||||
version = "0.0.2"
|
||||
authors = ["Craig Drummond <craig.p.drummond@gmail.com>"]
|
||||
edition = "2018"
|
||||
license = "GPL-3.0-only"
|
||||
@@ -17,7 +17,7 @@ rusqlite = { version = "0.25.0", features = ["bundled"] }
|
||||
log = "0.4.14"
|
||||
env_logger = "0.8.4"
|
||||
indicatif = "0.16.2"
|
||||
lofty = "0.5.0"
|
||||
lofty = "0.5.3"
|
||||
dirs = "1"
|
||||
chrono = "0.4.19"
|
||||
regex = "1"
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
0.0.2
|
||||
-----
|
||||
1. Package vcruntime140.dll with Windows ZIP.
|
||||
2. Update user docs.
|
||||
3. Update ignore syntax to allow adding SQL WHERE clauses.
|
||||
4. Use newer version of tag reader library.
|
||||
5. If fail to remove old tracks from DB, then output more info.
|
||||
6. Fix removing old tracks when run under Windows.
|
||||
|
||||
0.0.1
|
||||
-----
|
||||
1. Initial release.
|
||||
+24
-11
@@ -110,9 +110,6 @@ when uploading the database file to LMS. This defaults to `127.0.0.1`
|
||||
* `ignore` specifies the name and location of a file containing items to ignore
|
||||
in mixes. See the `Ignore` section later on for more details.
|
||||
|
||||
All configuration items can be supplied on the command-line, and if so those
|
||||
specified override those from the config file.
|
||||
|
||||
|
||||
|
||||
Command-line parameters
|
||||
@@ -135,8 +132,8 @@ tracks are to be analysed and how many old tracks are left in the database.
|
||||
* `-L` / `--lms` Hostname, or IP address, of your LMS server.
|
||||
* `-n` / `--numtracks` Specify maximum number of tracks to analyse.
|
||||
|
||||
If any of these are used, then they will override their equivalent from the INI
|
||||
config file.
|
||||
Equivalent items specied in the INI config file (detailed above) will override
|
||||
any specified on the commandline.
|
||||
|
||||
`bliss-analyser` requires one extra parameter, which is used to determine the
|
||||
required task. This takes the following values:
|
||||
@@ -261,19 +258,35 @@ accomplished be setting the `Ignore` column to `1` for such tracks. To make this
|
||||
easier, `bliss-analyser` can read a text file containing items to ignore and
|
||||
will update the database as appropriate.
|
||||
|
||||
This `ignore` file is a plain text file where each line contains the unique
|
||||
path to be ignored. i.e. it could contain the complete path (relative to your
|
||||
music folder) of a track, an album name (to exclude a whole album), or an artist
|
||||
name (to exclude all tracks by the artist). e.g.
|
||||
This `ignore` file is a plain text file where each line contains either:
|
||||
|
||||
1. The unique path to be ignored. i.e. it could contain the complete path
|
||||
(relative to your music folder) of a track, an album name (to exclude a whole
|
||||
album), or an artist name (to exclude all tracks by the artist).
|
||||
2. An SQL selector. If so, line must start "SQL:" followed by code that will be
|
||||
run after WHERE
|
||||
|
||||
```
|
||||
ABBA/Gold - Greatest Hits/01 Dancing Queen.mp3
|
||||
AC-DC/Power Up/
|
||||
The Police/
|
||||
SQL:Genre='Blues'
|
||||
SQL:Genre LIKE '%Dance%'
|
||||
SQL:Genre='Rock'
|
||||
SQL:Genre LIKE 'Rock;%'
|
||||
SQL:Genre LIKE '%;Rock'
|
||||
SQL:Genre LIKE '%;Rock;%'
|
||||
```
|
||||
|
||||
This would exclude 'Dancing Queen' by ABBA, all of AC/DC's 'Power Up', and all
|
||||
tracks by 'The Police'
|
||||
This would exclude 'Dancing Queen' by ABBA, all of AC/DC's 'Power Up', all
|
||||
tracks by 'The Police', all tracks with 'Genre' set to 'Blues', and all tracks
|
||||
that have 'Dance' or 'Rock' as part of their 'Genre'.
|
||||
|
||||
The SQL LIKE lines do sub-string matching. So '%Dance%' will match any genre
|
||||
string that contains 'Dance' - e.g. 'Classical Dance'. The 4 lines with 'Rock'
|
||||
show how you can explicitly look for an exact match. The 1st line means 'Rock'
|
||||
is the only genre, 2nd means 'Rock' is the first genre, 3rd means 'Rock' is the
|
||||
last genre, and 4th means 'Rock' is amongs other genres.
|
||||
|
||||
Assuming `config.ini` is in the current folder and contains valid entries, this
|
||||
is accomplished as follows:
|
||||
|
||||
@@ -158,23 +158,31 @@ impl Db {
|
||||
let mut to_remove:Vec<String> = Vec::new();
|
||||
for tr in track_iter {
|
||||
let mut db_path:String = tr.unwrap().0;
|
||||
let orig_path = db_path.clone();
|
||||
if cfg!(windows) {
|
||||
db_path = db_path.replace("/", "\\");
|
||||
}
|
||||
let path = mpath.join(PathBuf::from(db_path.clone()));
|
||||
|
||||
if !path.exists() {
|
||||
to_remove.push(db_path);
|
||||
to_remove.push(orig_path);
|
||||
}
|
||||
}
|
||||
log::info!("Num non-existant tracks: {}", to_remove.len());
|
||||
if !dry_run {
|
||||
let num_to_remove = to_remove.len();
|
||||
log::info!("Num non-existant tracks: {}", num_to_remove);
|
||||
if !dry_run && num_to_remove>0 {
|
||||
let count_before = self.get_track_count();
|
||||
for t in to_remove {
|
||||
log::debug!("Remove '{}'", t);
|
||||
match self.conn.execute("DELETE FROM Tracks WHERE File = ?;", params![t]) {
|
||||
Ok(_) => { },
|
||||
Err(_) => { }
|
||||
Err(e) => { log::error!("Failed to remove '{}' - {}", t, e) }
|
||||
}
|
||||
}
|
||||
let count_now = self.get_track_count();
|
||||
if (count_now + num_to_remove) != count_before {
|
||||
log::error!("Failed to remove all tracks. Count before: {}, wanted to remove: {}, count now: {}", count_before, num_to_remove, count_now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,11 +257,19 @@ impl Db {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_ignore(&self, like:&str) {
|
||||
log::info!("Ignore: {}", like);
|
||||
match self.conn.execute(&format!("UPDATE Tracks SET Ignore=1 WHERE File LIKE \"{}%\"", like), []) {
|
||||
Ok(_) => { },
|
||||
Err(e) => { log::error!("Failed set Ignore column for '{}'. {}", like, e); }
|
||||
pub fn set_ignore(&self, line:&str) {
|
||||
log::info!("Ignore: {}", line);
|
||||
if line.starts_with("SQL:") {
|
||||
let sql = &line[4..];
|
||||
match self.conn.execute(&format!("UPDATE Tracks Set Ignore=1 WHERE {}", sql), []) {
|
||||
Ok(_) => { },
|
||||
Err(e) => { log::error!("Failed set Ignore column for '{}'. {}", line, e); }
|
||||
}
|
||||
} else {
|
||||
match self.conn.execute(&format!("UPDATE Tracks SET Ignore=1 WHERE File LIKE \"{}%\"", line), []) {
|
||||
Ok(_) => { },
|
||||
Err(e) => { log::error!("Failed set Ignore column for '{}'. {}", line, e); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user