diff options
author | mono-b <monoblanco@DRAINERDOMAIN.localdomain> | 2022-12-18 23:58:07 -0300 |
---|---|---|
committer | mono-b <monoblanco@DRAINERDOMAIN.localdomain> | 2022-12-18 23:58:07 -0300 |
commit | 476493c61679764b33734512f023a627dcca9ecf (patch) | |
tree | 0db36282ab18c2b8d6eb15efab2eb49ef2eb8de3 /guides/consume-media-the-right-way-newsboat |
Diffstat (limited to 'guides/consume-media-the-right-way-newsboat')
-rw-r--r-- | guides/consume-media-the-right-way-newsboat/index.html | 223 |
1 files changed, 223 insertions, 0 deletions
diff --git a/guides/consume-media-the-right-way-newsboat/index.html b/guides/consume-media-the-right-way-newsboat/index.html new file mode 100644 index 0000000..ebef5a1 --- /dev/null +++ b/guides/consume-media-the-right-way-newsboat/index.html @@ -0,0 +1,223 @@ +<!DOCTYPE html> +<html lang="en"> + + <head><title>Newsboat – dd</title> + + +<meta name="viewport" content="width=device-width, initial-scale=1"> +<meta charset="UTF-8"> +<meta name="robots" content="index, follow"> +<meta name="description" content="Minimal and personal website about GNU/Linux guides and other stuff"> +<meta name="keywords" content="linux, hosting, guides, tech, blog, networking, memes"> +<meta name="author" content="mb"> + + +<link rel="shortcut icon" href="/images/favicon.ico"> + + +<link rel="stylesheet" href="https://drainerdomain.xyz/css/dark.css"> +</head> + <body> + <div class="page"> + <section> + <a class="home" href="/index.html">← Back to home</a> + <header class="content__header"> + <h1>>Newsboat_</h1> + <hr> + </header> + <div class="content__body"> + <p>Allthough I’ve riced <a href="https://github.com/newsboat/newsboat">newsboat</a>, this will be a guide focusing on the important aspect of the program. Newsboat allows the user +to read RSS/Atom feeds, which are usually generated by the website itself or sometimes by a frontend or third party app. The main +reason to use this program is the fact that you won’t need an account in sites such as Youtube, Reddit, or Twitter anymore. Also, that you’ll +have sort of a centralized way to consume (which includes reading text, listening to podcasts or watching videos) pretty much any site on the +internet by using only a terminal program, which is by far faster and more desirable. This guide includes:</p> +<ul> +<li>Brief explanation on how it works (program is very intuitive to use)</li> +<li>Setup of other programs</li> +<li>Running newsboat in the background so it notifies the user when new article appears (optional)</li> +<li>Multiple macro configurations that you might find very useful (optional but HIGHLY recommended)</li> +</ul> +<h1 id="installation">Installation</h1> +<p>The software is at almost any repository. In case it is not on your distro, you can always build it from source.</p> +<p>For Arch-based systems:</p> +<pre tabindex="0"><code>pacman -S newsboat mpv +</code></pre><p>I use <code>firefox</code> for opening up links (unless is the article has only text) and <code>mpv</code> to reproduce videos and audios. +You can use any other browser and media player obviously. Or, you can use something like <code>w3m</code> to read text, but remember to change +it as the browser when setting up the program.</p> +<p>Also, if you want to download videos/audios I recommend installing <a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a> from its github’s repository. +The installation is straightforward and the software is easier to update by using <code>yt-dlp -U</code> once needed. This program is a fork of the discontinued +<code>youtube-dl</code> which may still appear in some distro’s repositories.</p> +<h1 id="configuration">Configuration</h1> +<h2 id="newsboat">Newsboat</h2> +<p>Newsboat won’t run unless the file <code>urls</code> has something inside. Both <code>config</code> and <code>urls</code> files are at either <code>$HOME/.newsboat</code> or <code>$XDG_CONFIG_HOME/newsboat</code>. +Put something inside the <code>urls</code> file. I recommend using the following frontends for getting the feeds:</p> +<ul> +<li>Twitter -> nitter</li> +<li>Youtube -> Invidious</li> +<li>Reddit -> teddit</li> +</ul> +<p>Say you want to add the youtube channel <code>HydeWars</code> to your feed. It will look like this:</p> +<pre tabindex="0"><code>https://vid.puffyan.us/feed/channel/UCfUaZ8Ra7m7BqUEACv2jySw +</code></pre><p>So basically, you need to get the channel’s ID which is <code>UCfUaZ8Ra7m7BqUEACv2jySw</code> and add it at the end of the url, where +<code>vid.puffyan.us</code> is an instance of Invidious. How you find the ID of a YT channel is a matter of having at least a 2 digits IQ. +If you don’t want to use an Invidious instance, you can go to any Youtube channel and view the souce code, filter keyword <code>rss</code> and +see how the URL looks.</p> +<p>You can also tag URLs and then press <code>t</code> by adding the tag at the end of the string after a blank space:</p> +<pre tabindex="0"><code>https://vid.puffyan.us/feed/channel/UCfUaZ8Ra7m7BqUEACv2jySw MDE +</code></pre><p>Now open <code>config</code> file and add:</p> +<pre tabindex="0"><code># GENERAL # +reload-time 30 +auto-reload yes +browser "setsid -f $BROWSER --new-tab %u > /dev/null 2>&1" +cleanup-on-quit yes +history-limit 2000 +show-keymap-hint no +goto-next-feed no +error-log ".config/newsboat/error.log" +prepopulate-query-feeds yes +suppress-first-reload yes + +# NOTIFICATIONS # +notify-always no +notify-program "/usr/bin/dunstify" +notify-format "Newsboat: %d new articles" +</code></pre><p>Line 4 sets up the browser and forks it, while opening the url in a new tab. In my case, I have an env var set to <code>firefox</code>. Change <code>$BROWSER</code> to your browser’s name or software for reading text, if you need to. +Then, for notifications I use dunstify but you can use whatever you like. Rest is self explanatory, but keep in mind that if you are going to setup notifications you should +keep <code>reload-time</code> and <code>auto-reload</code> as they are.</p> +<p>Optionally, you can set up vim-like bindings:</p> +<pre tabindex="0"><code># Vim keybindings +unbind-key j +unbind-key k +unbind-key ENTER +unbind-key o + +bind-key o open +bind-key k up +bind-key j down +</code></pre><h2 id="mpv">Mpv</h2> +<p>Open <code>$XDG_CONFIG_HOME/mpv/mpv.conf</code> and add:</p> +<pre tabindex="0"><code># Cache +cache=yes +--stream-buffer-size=8MiB + +# Quality stream +ytdl-format=bestvideo[height<=?720]+bestaudio/best + +# Yt-dlp hook +script-opts-append=ytdl_hook-ytdl_path=yt-dlp +</code></pre><p>This sets up a <code>yt-dlp</code> hook that will make the streaming faster. Also, if you want higher/lesser quality, change the height value.</p> +<h2 id="yt-dlp">Yt-dlp</h2> +<p>I recommend you to set up a download folder. Open up <code>$XDG_CONFIG_HOME/yt-dlp/config</code> and add:</p> +<pre tabindex="0"><code>-o '/path/to/folder/%(title)s.%(ext)s' +</code></pre><p>This will save the video/audio to a folder using metadata.</p> +<h1 id="running-newsboat-through-a-script-for-notifications">Running newsboat through a script for notifications</h1> +<p>Instead of running newsboat directly, I use a simple script so it is always on the background. You can also achieve this with cronjobs.</p> +<pre tabindex="0"><code>#!/bin/sh + +while true; do + kill $(pidof newsboat) + rm $XDG_CONFIG_HOME/newsboat/queue + $TERMINAL -e newsboat + if [[ $? == 0 ]] ; then + exec newsboat && break + else + break + fi +done +</code></pre><p><code>chmod +x</code> the script and remember to use it instead of directly executing newsboat. In my case, I use an i3’s keybinding for quick access, and also +for executing the script only one time as soon as the window manager initializes.</p> +<h1 id="macros">Macros</h1> +<p>A macro is used for executing a sequence of commands by pressing a key or a combination of keys. In our case, for using the browser setting as not really a browser, but anything we like. For example, as a media player +to reproduce a YT video. To execute a macro press <code>,</code> + <code>key</code>.</p> +<p>Here is a list of some macros I’ve came up with that are very useful (add them to newsboat’s config file):</p> +<h2 id="queue-videos-clear-playlist-and-reproduce-playlist">Queue videos, clear playlist and reproduce playlist</h2> +<pre tabindex="0"><code>macro a set browser "echo %u >> ~/.config/newsboat/queue" ; open-in-browser ; set browser "$BROWSER %u" +macro c set browser "rm $HOME/.config/newsboat/queue > /dev/null 2>&1" ; open-in-browser ; set browser "$BROWSER %u" +macro p set browser "kill $(pidof mpv) ; setsid -f mpv --playlist=$HOME/.config/newsboat/queue > /dev/null 2>&1" ; open-in-browser ; set browser "$BROWSER %u" +</code></pre><p>The idea of these 3 macros is creating, playing or deleting a playlist. If you take a look at the script in the previous section, this file named <code>queue</code> gets deleted when the script executes. +For adding videos or even audios to said file you need to focus the article on a feed.</p> +<h2 id="play-queued-videos-fullscreen-second-monitor">Play queued videos fullscreen second monitor</h2> +<pre tabindex="0"><code>macro P set browser "kill $(pidof mpv) ; setsid -f mpv --x11-name=newsboatfs --fullscreen=yes --playlist=$HOME/.config/newsboat/queue > /dev/null 2>&1" ; open-in-browser ; set browser "$BROWSER %u" +</code></pre><h2 id="play-video">Play video</h2> +<pre tabindex="0"><code>macro v set browser "kill $(pidof mpv) ; setsid -f mpv %u > /dev/null 2>&1" ; open-in-browser-and-mark-read ; set browser "$BROWSER %u" +</code></pre><h2 id="play-video-floating-mode">Play video floating mode</h2> +<pre tabindex="0"><code>macro i set browser "kill $(pidof mpv) ; setsid -f mpv --x11-name=mpvfloat %u > /dev/null 2>&1" ; open-in-browser-and-mark-read ; set browser "$BROWSER %u" +</code></pre><h2 id="play-audio-only">Play audio only</h2> +<pre tabindex="0"><code>macro A set browser "kill $(pidof mpv) ; setsid -f mpv %u --no-video > /dev/null 2>&1" ; open-in-browser-and-mark-read ; set browser "$BROWSER %u" +</code></pre><h2 id="play-fullscreen-i3-sends-it-to-second-monitor-useful-for-playing-all-the-videos-from-a-channel">Play fullscreen, i3 sends it to second monitor (useful for playing all the videos from a channel)</h2> +<pre tabindex="0"><code>macro f set browser "kill $(pidof mpv) ; setsid -f mpv --x11-name=newsboatfs --fullscreen=yes %u > /dev/null 2>&1" ; open-in-browser ; set browser "$BROWSER %u" +</code></pre><h2 id="download-video">Download video</h2> +<pre tabindex="0"><code>macro y set browser "yt-dlp %u" ; open-in-browser ; set browser "$BROWSER %u" +</code></pre><h2 id="open-in-default-browser">Open in default browser</h2> +<pre tabindex="0"><code>macro o open-in-browser +</code></pre><p>NOTE: Keep in mind that for sending the videos/articles to another monitor you need to rename the X instance to whatever you like so you can then manipulate it with your window manager. +Using i3 would look like this:</p> +<pre tabindex="0"><code>for_window [instance="newsboatfs"] move container to workspace $ws10 +for_window [instance="mpvfloat"] floating enable, resize set 960 540, move container position center +</code></pre><p>Where <code>$ws10</code> outputs to <code>HDMI-1</code>:</p> +<pre tabindex="0"><code>workspace "10" output HDMI-1 +</code></pre><p>Use <code>xrandr</code> to know display names.</p> + + </div> + + </section> + </div> + <footer class="page__footer"><ul class="buttons"> + + <li> + <a href="https://drainerdomain.xyz"><img src="/buttons/drainerdomain2.gif" alt="drainerdomain"></a> + </li> + + <li> + <a href="https://landchad.net"><img src="/buttons/landchad.gif" alt="LandChud"></a> + </li> + + <li> + <a href="https://tomfasano.net"><img src="/buttons/tomfasano.gif" alt="Tom Fasano"></a> + </li> + + <li> + <a href="https://neovim.io"><img src="/buttons/neovim.gif" alt="neovim"></a> + </li> + + <li> + <a href="https://gohugo.io"><img src="/buttons/hugo.gif" alt="neovim"></a> + </li> + + <li> + <a href="https://wiby.org"><img src="/buttons/wiby.gif" alt="wiby"></a> + </li> + + <li> + <a href="https://gnu.org"><img src="/buttons/gnu-linux.png" alt="gnu"></a> + </li> + + <li> + <a href="https://stephenvk.xyz"><img src="/buttons/stephenvk.gif" alt="stephenvk"></a> + </li> + + <li> + <a href="https://canoemail.net"><img src="/buttons/canoemail.gif" alt="canoemail services"></a> + </li> + + <li> + <a href="https://heaventreey.xyz"><img src="/buttons/heaventree.gif" alt="heaventree webring"></a> + </li> + + <li> + <a href="https://spyware.neocities.org"><img src="/buttons/spywaredotneocities.png" alt="spywarewatchdog"></a> + </li> + + <li> + <a href="https://getmonero.org"><img src="/buttons/getmonero.gif" alt="Get Monero"></a> + </li> + + <li> + <a href="https://digdeeper.neocities.org"><img src="/buttons/digdeeper.png" alt="Digdeeper"></a> + </li> + +</ul> +</footer> + </body> + +</html> |