Skip to content

Commit

Permalink
Merge pull request #60 from LSchallot/development
Browse files Browse the repository at this point in the history
0.7.0 Development
  • Loading branch information
LSchallot authored Jan 12, 2025
2 parents 707eda0 + bed5cb3 commit f8018a4
Show file tree
Hide file tree
Showing 31 changed files with 2,673 additions and 1,946 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jellyroller"
version = "0.6.0"
version = "0.7.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -19,3 +19,4 @@ comfy-table = "7.0.1"
image = "0.25.1"
base64 = "0.22.1"
csv = "1.3.1"

66 changes: 38 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,46 @@ Any previous user auth tokens will be converted to an API key upon next executio
## Usage Information

```
jellyroller 0.6.0
jellyroller 0.7.0
A CLI controller for managing Jellyfin
Usage: jellyroller.exe <COMMAND>
Commands:
add-user Creates a new user
add-users Uses the supplied file to mass create new users
create-report Creates a report of either activity or available movie items
delete-user Deletes an existing user
list-users Lists the current users with basic information
reset-password Resets a user's password
server-info Displays the server information
list-logs Displays the available system logs
show-log Displays the requested logfile
reconfigure Reconfigure the connection information
get-devices Show all devices
remove-device-by-username Removes all devices associated with the specified user
get-scheduled-tasks Show all scheduled tasks and their status
execute-task-by-name Executes a scheduled task by name
scan-library Start a library scan
disable-user Disable a user
enable-user Enable a user
execute-task-by-name Executes a scheduled task by name
generate-report Generate a report for an issue
get-devices Show all devices
get-libraries Gets the libraries available to the configured user
get-packages Lists all available packages
get-plugins Returns a list of installed plugins
get-repositories Lists all current repositories
get-scheduled-tasks Show all scheduled tasks and their status
grant-admin Grants the specified user admin rights
install-package Installs the specified package
list-logs Displays the available system logs
list-users Lists the current users with basic information
reconfigure Reconfigure the connection information
register-library Registers a new library
register-repository Registers a new Plugin Repository
remove-device-by-username Removes all devices associated with the specified user
reset-password Resets a user's password
revoke-admin Revokes admin rights from the specified user
restart-jellyfin Restarts Jellyfin
shutdown-jellyfin Shuts down Jellyfin
get-libraries Gets the libraries available to the configured user
get-plugins Returns a list of installed plugins
add-users Uses the supplied file to mass create new users
update-users Mass update users in the supplied file
create-report Creates a report of either activity or available movie items
scan-library Start a library scan
search-media Executes a search of your media
update-image-by-name Updates image of specified file by name
server-info Displays the server information
show-log Displays the requested logfile
shutdown-jellyfin Shuts down Jellyfin
update-image-by-id Updates image of specified file by id
generate-report Generate a report for an issue
update-image-by-name Updates image of specified file by name
update-metadata Updates metadata of specified id with metadata provided by specified file
register-library Registers a new library
register-repository Registers a new Plugin Repository
get-repositories Lists all current repositories
get-packages Lists all available packages
install-package Installs the specified package
update-users Mass update users in the supplied file
help Print this message or the help of the given subcommand(s)
Options:
Expand All @@ -62,14 +62,24 @@ Options:

**Note:** All installation instructions assume the end-user can handle adding the application to their user's PATH.

### Mac / Linux (Homebrew)
```
brew tap LSchallot/JellyRoller https://github.com/LSchallot/JellyRoller
brew install --build-from-source jellyroller
```
### Windows (Scoop)
```
scoop add bucket jellyroller https://github.com/lschallot/jellyroller.git
scoop update
scoop install jellyroller
```

### Building From Source

Currently built with rustc 1.83.0. If building on a Linux machine, you may need to install openssl-devel.

```
git clone <git location>
cd jellyroller
cargo build
cargo install --git https://github.com/LSchallot/JellyRoller
```

### Initial Configuration
Expand Down
10 changes: 10 additions & 0 deletions bin/auto-pr.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#Requires -Version 5.1
param(
# overwrite upstream param
[String]$upstream = 'lschallot/jellyroller:master'
)

if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) }
$autopr = "$env:SCOOP_HOME/bin/auto-pr.ps1"
$dir = "$psscriptroot/../bucket" # checks the parent dir
Invoke-Expression -Command "$autopr -dir $dir -upstream $upstream $($args | ForEach-Object { "$_ " })"
5 changes: 5 additions & 0 deletions bin/checkhashes.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Requires -Version 5.1
if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) }
$checkhashes = "$env:SCOOP_HOME\bin\checkhashes.ps1"
$dir = "$psscriptroot\..\bucket" # checks the parent dir
Invoke-Expression -Command "$checkhashes -dir $dir $($args | ForEach-Object { "$_ " })"
5 changes: 5 additions & 0 deletions bin/checkurls.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Requires -Version 5.1
if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) }
$checkurls = "$env:SCOOP_HOME\bin\checkurls.ps1"
$dir = "$psscriptroot\..\bucket" # checks the parent dir
Invoke-Expression -Command "$checkurls -dir $dir $($args | ForEach-Object { "$_ " })"
12 changes: 12 additions & 0 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Requires -Version 5.1
param(
[String] $dir = "$PSScriptRoot\..\bucket",
[Parameter(ValueFromRemainingArguments = $true)]
[String[]] $remainArgs = @()
)

if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) }
$checkver = "$env:SCOOP_HOME\bin\checkver.ps1"
$remainArgs = ($remainArgs | Select-Object -Unique) -join ' '

Invoke-Expression -Command "$checkver -dir $dir $remainArgs"
5 changes: 5 additions & 0 deletions bin/formatjson.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Requires -Version 5.1
if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) }
$formatjson = "$env:SCOOP_HOME\bin\formatjson.ps1"
$dir = "$psscriptroot\..\bucket" # checks the parent dir
Invoke-Expression -Command "$formatjson -dir $dir $($args | ForEach-Object { "$_ " })"
6 changes: 6 additions & 0 deletions bin/missing-checkver.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Requires -Version 5.1

if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) }
$missing_checkver = "$env:SCOOP_HOME\bin\missing-checkver.ps1"
$dir = "$psscriptroot\..\bucket" # checks the parent dir
Invoke-Expression -Command "$missing_checkver -dir $dir $($args | ForEach-Object { "$_ " })"
27 changes: 27 additions & 0 deletions bucket/jellyroller.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"version": "0.6.0",
"description": "Jellyroller is a CLI configuration tool for Jellyfin",
"homepage": "https://github.com/lschallot/jellyroller",
"license": "GPL-2",
"architecture": {
"64bit": {
"url": "https://github.com/lschallot/jellyroller/releases/download/v0.6.0/jellyroller-x86_64-windows.tar.gz",
"hash": "3db3bb63461d9906058d600c181f75e80294a6a0a018437a53a8e0261e3b31d9"
}
},
"bin": "jellyroller.exe",
"checkver": {
"url": "https://api.github.com/repos/lschallot/jellyroller/releases/latest",
"regex": "/v([\\w-.]+)"
},
"autoupdate": {
"architecture": {
"64bit": {
"url": "https://github.com/lschallot/jellyroller/releases/download/v$version/jellyroller-x86_64-windows.tar.gz"
}
},
"hash": {
"url": "$url.sha256"
}
}
}
21 changes: 15 additions & 6 deletions src/entities/activity_details.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde_derive::Deserialize;
use serde_derive::Serialize;

use comfy_table::{ Table, ContentArrangement };
use comfy_table::{ContentArrangement, Table};

#[derive(Default, Clone, Serialize, Deserialize)]
pub struct ActivityDetails {
Expand Down Expand Up @@ -42,7 +42,15 @@ impl ActivityDetails {
let mut table = Table::new();
table
.set_content_arrangement(ContentArrangement::Dynamic)
.set_header(vec!["Date", "User", "Type", "Severity", "Name", "ShortOverview", "Overview"]);
.set_header(vec![
"Date",
"User",
"Type",
"Severity",
"Name",
"ShortOverview",
"Overview",
]);
for activity in activities.items {
table.add_row(vec![
&activity.date,
Expand All @@ -51,17 +59,18 @@ impl ActivityDetails {
&activity.severity,
&activity.name,
&activity.short_overview,
&activity.overview
&activity.overview,
]);
}
println!("{table}");
}

pub fn print_as_csv(activities: ActivityDetails) -> String{
pub fn print_as_csv(activities: ActivityDetails) -> String {
// first print the headers
let mut data: String = "Date,User,Type,Severity,Name,ShortOverview,Overview\n".to_owned();
for activity in activities.items {
let piece = format!("{},{},{},{},{},{},{}\n",
let piece = format!(
"{},{},{},{},{},{},{}\n",
&activity.date,
&activity.id.to_string(),
&activity.type_field,
Expand All @@ -74,4 +83,4 @@ impl ActivityDetails {
}
data
}
}
}
29 changes: 19 additions & 10 deletions src/entities/device_details.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use comfy_table::{ Table, ContentArrangement };
use comfy_table::{ContentArrangement, Table};

#[derive(Serialize, Deserialize)]
pub struct DeviceRootJson {
#[serde(rename = "Items")]
pub items: Vec<DeviceDetails>
pub items: Vec<DeviceDetails>,
}

#[derive(Serialize, Deserialize)]
Expand All @@ -15,24 +15,35 @@ pub struct DeviceDetails {
#[serde(rename = "LastUserName")]
pub lastusername: String,
#[serde(rename = "DateLastActivity")]
pub lastactivity: String
pub lastactivity: String,
}

impl DeviceDetails {
pub fn new(id: String, name: String, lastusername: String, lastactivity: String) -> DeviceDetails {
DeviceDetails{
pub fn new(
id: String,
name: String,
lastusername: String,
lastactivity: String,
) -> DeviceDetails {
DeviceDetails {
id,
name,
lastusername,
lastactivity
lastactivity,
}
}

pub fn csv_print(devices: &[DeviceDetails]) {
for device in devices {
println!("{}, {}, {}", &device.id, &device.name, &device.lastusername);
}
}

pub fn json_print(devices: &[DeviceDetails]) {
println!("{}", serde_json::to_string_pretty(&devices).unwrap());
}

pub fn table_print(devices: &[DeviceDetails]) {
pub fn table_print(devices: Vec<DeviceDetails>) {
let mut table = Table::new();
table
.set_content_arrangement(ContentArrangement::Dynamic)
Expand All @@ -43,6 +54,4 @@ impl DeviceDetails {
}
println!("{table}");
}


}
}
35 changes: 28 additions & 7 deletions src/entities/library_details.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use comfy_table::{ Table, ContentArrangement };
use comfy_table::{ContentArrangement, Table};

pub type LibraryRootJson = Vec<LibraryDetails>;

Expand All @@ -15,12 +15,23 @@ pub struct LibraryDetails {
}

impl LibraryDetails {
pub fn new(name: String, collection_type: String, item_id: String, refresh_status: String) -> LibraryDetails {
LibraryDetails{
pub fn new(
name: String,
collection_type: String,
item_id: String,
refresh_status: String,
) -> LibraryDetails {
LibraryDetails {
name,
collection_type,
item_id,
refresh_status
refresh_status,
}
}

pub fn csv_print(libraries: Vec<LibraryDetails>) {
for library in libraries {
println!("{}, {}, {}, {}", library.name, library.collection_type, library.item_id, library.refresh_status);
}
}

Expand All @@ -33,10 +44,20 @@ impl LibraryDetails {
table
.set_content_arrangement(ContentArrangement::Dynamic)
.set_width(120)
.set_header(vec!["Library Name", "Collection Type", "Library Id", "Refresh Status"]);
.set_header(vec![
"Library Name",
"Collection Type",
"Library Id",
"Refresh Status",
]);
for library in libraries {
table.add_row(vec![library.name, library.collection_type, library.item_id, library.refresh_status]);
table.add_row(vec![
library.name,
library.collection_type,
library.item_id,
library.refresh_status,
]);
}
println!("{table}");
}
}
}
Loading

0 comments on commit f8018a4

Please sign in to comment.