Debian Codegraph @

podcasts-data/src/lib.rs

raw symbols SCIP
1 // lib.rs
2 //
3 // Copyright 2017 Jordan Petridis <[email protected]>
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // SPDX-License-Identifier: GPL-3.0-or-later
19
20 #![recursion_limit = "1024"]
21
22 #[cfg(test)]
23 #[macro_use]
24 extern crate maplit;
25
26 #[macro_use]
27 extern crate derive_builder;
28 #[macro_use]
29 extern crate diesel;
30 #[macro_use]
31 extern crate log;
32
33 pub mod database;
34 #[allow(missing_docs)]
35 pub mod dbqueries;
36 pub mod discovery;
37 #[allow(missing_docs)]
38 pub mod downloader;
39 #[allow(missing_docs)]
40 pub mod errors;
41 mod feed;
42 pub(crate) mod models;
43 pub mod opml;
44 mod parser;
45 pub mod pipeline;
46 mod schema;
47 pub mod utils;
48
49 pub use crate::feed::{Feed, FeedBuilder};
50 pub use crate::models::Save;
51 pub use crate::models::{
52 Episode, EpisodeCleanerModel, EpisodeId, EpisodeModel, EpisodeWidgetModel, Show,
53 ShowCoverModel, ShowId, Source, SourceId,
54 };
55
56 // Set the user agent, See #53 for more
57 // Keep this in sync with Tor-browser releases
58 /// The user-agent to be used for all the requests.
59 /// It originates from the Tor-browser UA.
60 pub const USER_AGENT: &str =
61 "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0";
62
63 /// [XDG Base Directory](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) Paths.
64 pub mod xdg_dirs {
65 use std::path::PathBuf;
66 use std::sync::LazyLock;
67
68 pub(crate) static PODCASTS_XDG: LazyLock<xdg::BaseDirectories> =
69 LazyLock::new(|| xdg::BaseDirectories::with_prefix("gnome-podcasts").unwrap());
70
71 /// XDG_DATA Directory `Pathbuf`.
72 pub static PODCASTS_DATA: LazyLock<PathBuf> = LazyLock::new(|| {
73 PODCASTS_XDG
74 .create_data_directory(PODCASTS_XDG.get_data_home())
75 .unwrap()
76 });
77
78 /// XDG_CONFIG Directory `Pathbuf`.
79 pub static PODCASTS_CONFIG: LazyLock<PathBuf> = LazyLock::new(|| {
80 PODCASTS_XDG
81 .create_config_directory(PODCASTS_XDG.get_config_home())
82 .unwrap()
83 });
84
85 /// XDG_CACHE Directory `Pathbuf`.
86 pub static PODCASTS_CACHE: LazyLock<PathBuf> = LazyLock::new(|| {
87 PODCASTS_XDG
88 .create_cache_directory(PODCASTS_XDG.get_cache_home())
89 .unwrap()
90 });
91
92 /// GNOME Podcasts Download Directory `PathBuf`.
93 pub static DL_DIR: LazyLock<PathBuf> =
94 LazyLock::new(|| PODCASTS_XDG.create_data_directory("Downloads").unwrap());
95
96 /// GNOME Podcasts Tmp Directory `PathBuf`.
97 pub static TMP_DIR: LazyLock<PathBuf> =
98 LazyLock::new(|| PODCASTS_XDG.create_data_directory("tmp").unwrap());
99 }