oSumAtrIX / DownOnSpot

🎧 A Spotify music and playlist downloader working with free Spotify accounts written in Rust
https://osumatrix.me
GNU General Public License v3.0
555 stars 44 forks source link

Cannot compile the project #13

Closed M4TTRX closed 2 years ago

M4TTRX commented 2 years ago

Describe the bug A clear and concise description of what the bug is. Hi, I'm new to Rust so this issue may be dumb, but I thought it could be helpful to ask in case other noobs like me run into it.

I am unable to compile the project (cargo build --release) gives me a series of errors.

To Reproduce Steps to reproduce the behavior:

  1. I installed the rust, then set it to the nightly version: cargo 1.59.0-nightly (fcef61230 2021-12-17)
  2. I removed librespot because I dont need to download the music with a free spotify account, I want to try with a premium account.
  3. I installed the VS C++ build suite.
  4. I tried to run cargo build --release but it gives me errors.

Expected behavior I think it's supposed to build and give the message you described in the README of this project

Screenshots

Here are the errors I get:

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
 --> src\downloader.rs:6:5
  |
6 | use librespot::audio::{AudioDecrypt, AudioFile};
  |     ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
 --> src\downloader.rs:7:5
  |
7 | use librespot::core::audio_key::AudioKey;
  |     ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
 --> src\downloader.rs:8:5
  |
8 | use librespot::core::session::Session;
  |     ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
 --> src\downloader.rs:9:5
  |
9 | use librespot::core::spotify_id::SpotifyId;
  |     ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\downloader.rs:10:5
   |
10 | use librespot::metadata::{FileFormat, Metadata, Track};
   |     ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
 --> src\spotify.rs:2:5
  |
2 | use librespot::core::authentication::Credentials;
  |     ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
 --> src\spotify.rs:3:5
  |
3 | use librespot::core::config::SessionConfig;
  |     ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
 --> src\spotify.rs:4:5
  |
4 | use librespot::core::session::Session;
  |     ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared type `SpotifyId`
   --> src\downloader.rs:494:12
    |
494 |         let id = SpotifyId::from_base62(id)?;
    |                  ^^^^^^^^^ use of undeclared type `SpotifyId`

error[E0433]: failed to resolve: use of undeclared type `AudioFile`
   --> src\downloader.rs:537:19
    |
537 |         let encrypted = AudioFile::open(session, *file_id, 1024 * 1024, true).await?;
    |                         ^^^^^^^^^ use of undeclared type `AudioFile`

error[E0433]: failed to resolve: use of undeclared type `AudioDecrypt`
   --> src\downloader.rs:587:24
    |
587 |             let mut decrypted = AudioDecrypt::new(key, encrypted);
    |                                 ^^^^^^^^^^^^ use of undeclared type `AudioDecrypt`

error[E0433]: failed to resolve: use of undeclared type `AudioDecrypt`
   --> src\downloader.rs:625:24
    |
625 |             let mut decrypted = AudioDecrypt::new(key, encrypted);
    |                                 ^^^^^^^^^^^^ use of undeclared type `AudioDecrypt`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:686:4
    |
686 |             FileFormat::OGG_VORBIS_96 => Self::Ogg,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:687:4
    |
687 |             FileFormat::OGG_VORBIS_160 => Self::Ogg,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:688:4
    |
688 |             FileFormat::OGG_VORBIS_320 => Self::Ogg,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:689:4
    |
689 |             FileFormat::MP3_256 => Self::Mp3,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:690:4
    |
690 |             FileFormat::MP3_320 => Self::Mp3,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:691:4
    |
691 |             FileFormat::MP3_160 => Self::Mp3,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:692:4
    |
692 |             FileFormat::MP3_96 => Self::Mp3,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:693:4
    |
693 |             FileFormat::MP3_160_ENC => Self::Mp3,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:694:4
    |
694 |             FileFormat::MP4_128_DUAL => Self::Mp4,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:695:4
    |
695 |             FileFormat::OTHER3 => Self::Unknown,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:696:4
    |
696 |             FileFormat::AAC_160 => Self::Aac,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:697:4
    |
697 |             FileFormat::AAC_320 => Self::Aac,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:698:4
    |
698 |             FileFormat::MP4_128 => Self::Mp4,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:699:4
    |
699 |             FileFormat::OTHER5 => Self::Unknown,
    |             ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:709:5
    |
709 |                 FileFormat::OGG_VORBIS_320,
    |                 ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:710:5
    |
710 |                 FileFormat::AAC_320,
    |                 ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:711:5
    |
711 |                 FileFormat::MP3_320,
    |                 ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:713:23
    |
713 |             Self::Q256 => vec![FileFormat::MP3_256],
    |                                ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:715:5
    |
715 |                 FileFormat::OGG_VORBIS_160,
    |                 ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:716:5
    |
716 |                 FileFormat::AAC_160,
    |                 ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:717:5
    |
717 |                 FileFormat::MP3_160,
    |                 ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:719:22
    |
719 |             Self::Q96 => vec![FileFormat::OGG_VORBIS_96, FileFormat::MP3_96],
    |                               ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared type `FileFormat`
   --> src\downloader.rs:719:49
    |
719 |             Self::Q96 => vec![FileFormat::OGG_VORBIS_96, FileFormat::MP3_96],
    |                                                          ^^^^^^^^^^ use of undeclared type `FileFormat`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:59:11
   |
59 | impl From<librespot::core::mercury::MercuryError> for SpotifyError {
   |           ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:60:13
   |
60 |     fn from(_: librespot::core::mercury::MercuryError) -> Self {
   |                ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:65:11
   |
65 | impl From<librespot::core::session::SessionError> for SpotifyError {
   |           ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:66:13
   |
66 |     fn from(e: librespot::core::session::SessionError) -> Self {
   |                ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:68:4
   |
68 |             librespot::core::session::SessionError::IoError(e) => e.into(),
   |             ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:69:4
   |
69 |             librespot::core::session::SessionError::AuthenticationError(_) => {
   |             ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:76:11
   |
76 | impl From<librespot::core::spotify_id::SpotifyIdError> for SpotifyError {
   |           ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:77:13
   |
77 |     fn from(_: librespot::core::spotify_id::SpotifyIdError) -> Self {
   |                ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:82:11
   |
82 | impl From<librespot::core::channel::ChannelError> for SpotifyError {
   |           ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:83:13
   |
83 |     fn from(_: librespot::core::channel::ChannelError) -> Self {
   |                ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:88:11
   |
88 | impl From<librespot::core::audio_key::AudioKeyError> for SpotifyError {
   |           ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared crate or module `librespot`
  --> src\error.rs:89:13
   |
89 |     fn from(_: librespot::core::audio_key::AudioKeyError) -> Self {
   |                ^^^^^^^^^ use of undeclared crate or module `librespot`

error[E0433]: failed to resolve: use of undeclared type `Credentials`
  --> src\spotify.rs:25:21
   |
25 |         let credentials = Credentials::with_password(username, password);
   |                           ^^^^^^^^^^^ use of undeclared type `Credentials`

error[E0433]: failed to resolve: use of undeclared type `Session`
  --> src\spotify.rs:26:17
   |
26 |         let session = Session::connect(SessionConfig::default(), credentials, None).await?;
   |                       ^^^^^^^ use of undeclared type `Session`

error[E0433]: failed to resolve: use of undeclared type `SessionConfig`
  --> src\spotify.rs:26:34
   |
26 |         let session = Session::connect(SessionConfig::default(), credentials, None).await?;
   |                                        ^^^^^^^^^^^^^ use of undeclared type `SessionConfig`

error[E0412]: cannot find type `Session` in this scope
   --> src\downloader.rs:475:38
    |
475 |     async fn find_alternative(session: &Session, track : Track) -> Result<Track, SpotifyError> {
    |                                         ^^^^^^^ not found in this scope

error[E0412]: cannot find type `Track` in this scope
   --> src\downloader.rs:475:55
    |
475 |     async fn find_alternative(session: &Session, track : Track) -> Result<Track, SpotifyError> {
    |                                                          ^^^^^ not found in this scope
    |
help: consider importing this struct
    |
1   | use aspotify::Track;
    |

error[E0412]: cannot find type `Track` in this scope
   --> src\downloader.rs:475:72
    |
475 |     async fn find_alternative(session: &Session, track : Track) -> Result<Track, SpotifyError> {
    |                                                                           ^^^^^ not found in this scope
    |
help: consider importing this struct
    |
1   | use aspotify::Track;
    |

error[E0433]: failed to resolve: use of undeclared type `Track`
   --> src\downloader.rs:477:12
    |
477 |             let t = Track::get(&session, alt).await?;
    |                     ^^^^^ not found in this scope
    |
help: consider importing this struct
    |
1   | use aspotify::Track;
    |

error[E0412]: cannot find type `Session` in this scope
   --> src\downloader.rs:487:13
    |
487 |         session: &Session,
    |                   ^^^^^^^ not found in this scope

error[E0433]: failed to resolve: use of undeclared type `Track`
   --> src\downloader.rs:495:19
    |
495 |         let mut track = Track::get(session, id).await?;
    |                         ^^^^^ not found in this scope
    |
help: consider importing this struct
    |
1   | use aspotify::Track;
    |

error[E0412]: cannot find type `AudioFile` in this scope
   --> src\downloader.rs:582:14
    |
582 |         encrypted: AudioFile,
    |                    ^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `AudioKey` in this scope
   --> src\downloader.rs:583:8
    |
583 |         key: AudioKey,
    |              ^^^^^^^^ not found in this scope

error[E0412]: cannot find type `AudioFile` in this scope
   --> src\downloader.rs:618:14
    |
618 |         encrypted: AudioFile,
    |                    ^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `AudioKey` in this scope
   --> src\downloader.rs:619:8
    |
619 |         key: AudioKey,
    |              ^^^^^^^^ not found in this scope

error[E0412]: cannot find type `FileFormat` in this scope
   --> src\downloader.rs:683:11
    |
683 | impl From<FileFormat> for AudioFormat {
    |     -     ^^^^^^^^^^ not found in this scope
    |     |
    |     help: you might be missing a type parameter: `<FileFormat>`

error[E0412]: cannot find type `FileFormat` in this scope
   --> src\downloader.rs:684:13
    |
    |                ^^^^^^^^^^ not found in this scope
error[E0412]: cannot find type `FileFormat` in this scope
   --> src\downloader.rs:706:40
    |
704 | impl Quality {
    |     - help: you might be missing a type parameter: `<FileFormat>`
705 |     /// Get librespot FileFormat
706 |     pub fn get_file_formats(&self) -> Vec<FileFormat> {
    |                                           ^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `Session` in this scope
  --> src\spotify.rs:12:15
   |
12 |     pub session: Session,
   |                  ^^^^^^^ not found in this scope

error[E0599]: no method named `next` found for struct `Pin<&mut _>` in the current scope
   --> src\downloader.rs:558:30
    |
558 |         while let Some(result) = s.next().await {
    |                                    ^^^^ method not found in `Pin<&mut _>`
    |
    = note: `s` is a function, perhaps you wish to call it

Some errors have detailed explanations: E0412, E0433, E0599.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `down_on_spot` due to 65 previous errors

Desktop (please complete the following information):

Additional context

Lmk know if you need any other information

oSumAtrIX commented 2 years ago

This project depends on librespot. You can remove the git dependency to my fork. Cargo will then use the official crate.

Your Cargo.toml should contain either line:

librespot = { git = "ssh://git@github.com/oSumAtrIX/free-librespot.git", branch = "dev" }
librespot = "0.1.5"