GithubHelp home page GithubHelp logo

crunchy-labs / crunchyroll-rs Goto Github PK

View Code? Open in Web Editor NEW
49.0 4.0 10.0 627 KB

๐Ÿฆ€ Pure Rust implementation of the Crunchyroll API

License: Apache License 2.0

Rust 100.00%
anime crunchyroll crunchyroll-api rust

crunchyroll-rs's People

Contributors

adracea avatar bytedream avatar dependabot[bot] avatar derro8 avatar frooastside avatar ichbinleoon avatar malaow3 avatar nightquest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

crunchyroll-rs's Issues

BrowseSortType not working as expected with browse()

Description

I'm currently facing an issue while attempting to utilize the sort() method within the BrowseOptions during a call to browse(). Strangely, regardless of the selected BrowseSortType, the results returned do not adhere to the specified sorting order.

Steps to Reproduce

  1. Construct BrowseOptions with a specified sort type (e.g., Popularity, NewlyAdded, etc.).
  2. Invoke the browse() method using the constructed BrowseOptions.
  3. Examine the results for the sorting order.

Expected Behavior

The outcome of the browse() function should align with the specified BrowseSortType within the BrowseOptions.

Actual Behavior

Contrary to expectations, the results are not sorted in accordance with the chosen BrowseSortType. For instance, when utilizing Popularity, the anticipated order is from most to least popular. However, the returned list does not conform to this expected sorting.

Code Snippet

// Example code illustrating the issue
let crunchyroll = Crunchyroll::builder()
    .login_with_credentials(email, password)
    .await?;

let options = BrowseOptions::default().sort(crunchyroll_rs::search::BrowseSortType::NewlyAdded);

let mut browse_result = crunchyroll.browse(options.clone());
// The results are not sorted by newlyadded

Environment Information

  • Rust Version: 1.74.0
  • crunchyroll-rs Version: 0.8.0
  • Operating System: Windows 11

Not detecting japanese audio locale when searching for seasons

Recently, the library stopped correctly detecting audio locales for some series, most specifically the ja_JP locale.

The code I use for querying series is exemplified as follows:

let crunchyroll = init_cr(user, password, Some(get_system_loc())).await?; //get_system_loc() is correctly setting the locale

let opts = crunchyroll_rs::search::QueryOptions::default().result_type(QueryType::Series);

let qrrs = crunchyroll.query(&self.query, opts).await?;

which fetches series to display in a simple selection menu.

However, some series that only have the japanese audio language are incorrectly parsed with a en_US locale, for example:
image

And series that have multiple dubs alongside the japanese audio don't have the ja_JP locale at all:
image

watch_history() returning empty Series struct

Hello, I'm trying to use watch_history() in my Crunchyroll program and for some reason it's returning empty series structs between the episodes I want to retrieve. Here is my sample code and a sample output:

use crunchyroll_rs::{Crunchyroll, MediaCollection};
use crunchyroll_rs::common::StreamExt;
use anyhow::Result;
use crunchyroll_rs::list::WatchHistoryEntry;
use std::fs::File;
use std::io::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // log in to crunchyroll with your username and password
    let crunchyroll = Crunchyroll::builder()
        .login_with_credentials("", "")
        .await?;

    let mut file = File::create("foo.txt")?;

    let mut total = 0;
    let mut history = crunchyroll.watch_history();
    while let Some(item) = history.next().await {
        match item? {
            WatchHistoryEntry {id: entry, parent_id, parent_type, date_played, playhead, fully_watched, panel} => {
                total += 1;
                let anime_title: String;
                let format: String;
                match panel {
                    MediaCollection::Series(series) => {
                        format = String::from("Series");
                        anime_title = series.availability_notes;
                    }
                    MediaCollection::Season(season) => {
                        format = String::from("Season");
                        anime_title = season.title;
                    }
                    MediaCollection::Episode(episode) => {
                        format = String::from("Episode");
                        anime_title = episode.title;
                    }
                    MediaCollection::MovieListing(movie_list) => {
                        format = String::from("Movie Listing");
                        anime_title = movie_list.title;
                    }
                    MediaCollection::Movie(movie) => {
                        format = String::from("Movie");
                        anime_title = movie.title;
                    }
                    MediaCollection::MusicVideo(amv) => {
                        format = String::from("Anime Music Video");
                        anime_title = amv.title;
                    }
                    MediaCollection::Concert(conc) => {
                        format = String::from("Concert");
                        anime_title = conc.title;
                    }
                }
                let line = format!("Entry {}:Type: {} \tTitle of entry: {}\n",total, format, anime_title);
                file.write_all(&*line.into_bytes())?;
            }
        }
    }

    Ok(())
}

And part of my output:

Entry 2684:Type: Episode 	Title of entry: Proof of Evolution Synchro Monster
Entry 2685:Type: Episode 	Title of entry: A New Threat
Entry 2686:Type: Series 	Title of entry: 
Entry 2687:Type: Series 	Title of entry: 
Entry 2688:Type: Series 	Title of entry: 
Entry 2689:Type: Series 	Title of entry: 
Entry 2690:Type: Series 	Title of entry: 
Entry 2691:Type: Series 	Title of entry: 
Entry 2692:Type: Series 	Title of entry: 
Entry 2693:Type: Series 	Title of entry: 
Entry 2694:Type: Series 	Title of entry: 
Entry 2695:Type: Series 	Title of entry: 
Entry 2696:Type: Series 	Title of entry: 
Entry 2697:Type: Series 	Title of entry: 
Entry 2698:Type: Episode 	Title of entry: Reunion and Turnabout  โ€”  2nd Trial
Entry 2699:Type: Episode 	Title of entry: To Our Future!

When checking with my watch history, the episodes split by these empty entries are in order. If I removed the empty entries, the watch history would be uninterrupted. But these Series entries don't make sense to me. I tried grabbing other information from them, but I couldn't see anything. Any help you can provide would be fantastic, as these empty entries are preventing me from grabbing the entirety of my watch history (it's grabbing all but 20 episodes).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.