AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-264065

Ashark's questions

Martin Hope
Ashark
Asked: 2023-05-05 07:43:05 +0800 CST

如何从 fb2 书籍中提取目录?

  • 5

我有一本 fb2 格式的书。我想打印目录,其中包含“部分”、“章节”、“剧集”等的名称和编号。

有没有办法可以从终端执行此操作?有一个类似的问题,但对于 epub 格式。

我知道 fb2 是一种 xml 格式。但是有没有一种工具可以只提取TOC?它们在标签<section>,<title>和内<subtitle>。

如果没有,我想可以根据官方的FB2_to_txt.xsl文件制作 xsl 文件。也许ebook-convert可以做到这一点?

我正在写的书具有以下结构:

<?xml version="1.0" encoding="utf8"?>
<FictionBook xmlns:l="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.gribuser.ru/xml/fictionbook/2.0">
  <description>
    <title-info>
      <genre>fiction</genre>
      <author>
        <first-name>John</first-name>
        <last-name>Doe</last-name>
      </author>
      <book-title>Fiction Book</book-title>
      <annotation>
        <p>Hello</p>
      </annotation>
      <keywords>john, doe, fiction</keywords>
      <date value="2011-07-18">18.07.2011</date>
      <coverpage></coverpage>
      <lang>en</lang>
    </title-info>
    <document-info>
      <author>
        <first-name></first-name>
        <last-name></last-name>
        <nickname></nickname>
      </author>
      <program-used>Fb2 Gem</program-used>
      <date value="2011-07-18">18.07.2011</date>
      <src-url></src-url>
      <src-ocr></src-ocr>
      <id></id>
      <version>1.0</version>
    </document-info>
    <publish-info>
    </publish-info>
  </description>
  <body>
    <title>
      <p>John Doe</p>
      <empty-line/>
      <p>Fiction Book</p>
    </title>
    <section>
      <title>
        <p>Part 1</p>
        <p>Some name of Part 1</p>
      </title>
      <section>
        <title>
          <p>Chapter 1</p>
          <p>Some name of Chapter 1</p>
        </title>
        <subtitle>Episode 1</subtitle>
        <p>Line one of the first episode</p>
        <p>Line two of the first episode</p>
        <p>Line three of the first episode</p>
        <subtitle>Episode 2</subtitle>
        <p>Line one of the second episode</p>
        <p>Line two of the second episode</p>
        <p>Line three of the second episode</p>
      </section>
    </section>
    <section>
      <title>
        <p>Part 2</p>
        <p>Some name of Part 2</p>
      </title>
      <section>
        <title>
          <p>Chapter 3</p>
          <p>Some name of Chapter 3</p>
        </title>
        <subtitle>Episode 3</subtitle>
        <p>Line one of the third episode</p>
        <p>Line two of the third episode</p>
        <p>Line three of the third episode</p>
        <subtitle>Episode 4</subtitle>
        <p>Line one of the fourth episode</p>
        <p>Line two of the fourth episode</p>
        <p>Line three of the fourth episode</p>
      </section>
    </section>
  </body>
</FictionBook>

我想在输出中获得以下内容:

Part 1
Some name of Part 1
Chapter 1
Some name of Chapter 1
Episode 1
Episode 2
Part 2
Some name of Part 2
Chapter 3
Some name of Chapter 3
Episode 3
Episode 4
xml
  • 3 个回答
  • 40 Views
Martin Hope
Ashark
Asked: 2022-06-17 13:36:00 +0800 CST

有没有办法在 KDE Wayland 上获取窗口列表?

  • 2

在 X11 时代,我可以wmctrl -l列出可以在我的脚本中使用的可用窗口。

$ wmctrl -l
0x01000050  0 my-pc project1 – Readme.md

但是现在大多数应用程序都使用 Wayland。上述命令仅显示使用 XWayland 运行的窗口。

我希望能够在 Wayland 模式下使用应用程序,同时能够为我的脚本列出它们的窗口。那可能吗?我正在使用带有 KDE 的 Arch Linux。

kde x11
  • 1 个回答
  • 413 Views
Martin Hope
Ashark
Asked: 2022-05-19 10:09:59 +0800 CST

如何从 kde 快捷方式命令运行 sudo 命令?

  • 0

在 KDE 设置中,您可以分配一个快捷方式来执行您的任意命令。

要在 KDE 中为快捷方式分配命令,您可以执行以下操作。在System Settings-> Shortcuts->Custom Shortcuts中,右键单击,选择New-> Global Shortcut-> Command/URL。转到Action选项卡并填写命令。并在Trigger选项卡中分配实际的快捷方式。这种机制对于非 sudo 命令正常工作。

在此处输入图像描述

但不幸的是,当我使用需要 root 权限的命令时(假设sudo systemctl start something),它只是没有执行。

有没有办法绕过这个限制?我希望能够触发需要评估权限的操作。

permissions keyboard-shortcuts
  • 1 个回答
  • 360 Views
Martin Hope
Ashark
Asked: 2022-05-03 20:22:56 +0800 CST

如何在 KDE Dolphin 中共享文件夹?

  • 1

我希望能够在 Dolphin 中共享一个文件夹。右键单击文件夹,然后转到共享选项卡。不幸的是,我在那里看到一条消息:“您似乎没有足够的权限来管理 Samba 用户共享”:

在此处输入图像描述

我在 Arch Linux 上,如果这很重要的话。我已经安装了samba软件包,并且可以手动配置共享。但我希望能够从 gui 快速完成,就像在 Windows 上一样。另外,我已经看到在其他使用 KDE 的发行版中,这个共享选项卡确实有效。

如何解决这个问题?

permissions kde
  • 1 个回答
  • 1626 Views
Martin Hope
Ashark
Asked: 2022-04-06 11:10:35 +0800 CST

如何防止子进程干扰bash提示?

  • 0

有问题的应用程序是 DaVinci Resolve。我从终端启动它。当我关闭它时,来自应用程序的消息“Socket Disconnected”被写入终端输出。然后 bash 提示符正常显示。我开始输入新命令,突然在终端“Socket Disconnected”中出现另一条消息。这会干扰我所做的输入。它看起来像这样:

[andrew@unihost ~]$ davinci-resolve
... # Now I exit the application.
Host 'Fusion' Removed
FusionScript Server [37457] Terminated
Socket disconnected
[andrew@unihost ~]$ ls ls Socket disconnected
wtf!!!^C
[andrew@unihost ~]$

视频演示:https ://youtu.be/arcCOjrN7kw

为什么会发生这种情况,有没有办法防止这种情况发生?

我的猜测是主进程有一个子进程,即使在主进程死后它仍然活着。我找到了这个答案。是开发商的错吗?我可以以某种方式解决这个问题(对于子进程可能是 nohup)?

terminal process
  • 4 个回答
  • 209 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve