Compare commits

..

21 Commits

Author SHA1 Message Date
Linus Dierheimer 70df34caf9 Merge pull request #370 from LinusDierheimer/dev
Release 1.8.2
2022-12-31 12:45:13 +01:00
李通洲 c04b421f26 README: fix unexpectedly concated paragraphs 2022-12-31 19:33:44 +08:00
李通洲 e292470ade Release 1.8.2 2022-12-31 19:25:59 +08:00
李通洲 c0d3dc30e1 Changelog: update 1.8.2 2022-12-31 18:56:45 +08:00
李通洲 01df2ae3e4 CI: align artifact names to other platforms (Windows) 2022-12-31 18:56:45 +08:00
李通洲 f8174a67d7 Wifi: don't use libcJSON as wlanapi's dll name 2022-12-31 18:12:23 +08:00
李通洲 53265f6b7f Users: fix memleaks (Windows) 2022-12-31 18:12:23 +08:00
李通洲 f245492679 TerminalShell: fix shell detection when installed with scoop 2022-12-31 12:42:19 +08:00
Linus Dierheimer 6f92524ada Merge pull request #369 from LinusDierheimer/dev
Release 1.8.1
2022-12-30 18:51:52 +01:00
Linus Dierheimer b2ff1501aa Update Changelog 2022-12-30 18:49:58 +01:00
Linus Dierheimer fbb4ab590f Local IP: Key: Clear before reuse
#368
2022-12-30 18:42:26 +01:00
李通洲 e2cadf85f8 Changelog: credit #365 2022-12-30 22:03:53 +08:00
李通洲 b5c2c9ee7a Release 1.8.1 2022-12-30 22:00:11 +08:00
李通洲 1dabac9782 Media: remove the alias name Song to avoid confusion
So we don't have code like `#define FF_SONG_MODULE_NAME "Media"`.
Also fix the error `unknown option: --media-format`
2022-12-30 11:21:11 +08:00
Linus Dierheimer 50983f83f5 Generic decoding for mountpoints
#364
2022-12-29 23:19:44 +01:00
Linus Dierheimer 5026be2d28 Fix parsing mountpoints with backslashes
#364
2022-12-29 22:58:29 +01:00
Linus Dierheimer 70aad5c320 Fix parsing mountpoints with spaces
#364
2022-12-29 22:51:23 +01:00
Linus Dierheimer e74d21c0e5 Merge pull request #365 from IanManske/parse-color-fix
Fix color parsing.
2022-12-29 22:33:59 +01:00
Ian Manske 90d8677b7a Add missing else statement. 2022-12-29 12:51:00 -05:00
李通洲 7a5d88270e macOS: fix building with old xcode
Makes homebrew happy
https://github.com/Homebrew/homebrew-core/pull/119329
2022-12-30 01:13:04 +08:00
Linus Dierheimer 5599335965 Zip windows artifacts 2022-12-29 14:40:37 +01:00
19 changed files with 158 additions and 80 deletions
+15 -14
View File
@@ -141,7 +141,7 @@ jobs:
with:
msystem: CLANG64
update: true
install: git mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-cjson mingw-w64-clang-x86_64-vulkan-loader mingw-w64-clang-x86_64-opencl-icd
install: git zip mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-cjson mingw-w64-clang-x86_64-vulkan-loader mingw-w64-clang-x86_64-opencl-icd
- name: print msys version
run: uname -a
@@ -188,17 +188,17 @@ jobs:
- name: run tests
run: ctest
- name: create zip archive
run: zip fastfetch-$(./fastfetch --version-raw)-Windows.zip *.dll fastfetch.exe flashfetch.exe
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: fastfetch-windows
path: |
./*.dll
./fastfetch.exe
./flashfetch.exe
path: ./fastfetch-*-Windows.zip
windows-old:
name: Windows-old
win7:
name: Win7
runs-on: windows-latest
permissions:
security-events: write
@@ -215,7 +215,7 @@ jobs:
with:
msystem: MINGW64
update: true
install: git mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-cjson mingw-w64-x86_64-vulkan-loader mingw-w64-x86_64-opencl-icd
install: git zip mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-cjson mingw-w64-x86_64-vulkan-loader mingw-w64-x86_64-opencl-icd
- name: print msys version
run: uname -a
@@ -262,14 +262,14 @@ jobs:
- name: run tests
run: ctest
- name: create zip archive
run: zip fastfetch-$(./fastfetch --version-raw)-Win7.zip *.dll fastfetch.exe flashfetch.exe
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: fastfetch-windows-old
path: |
./*.dll
./fastfetch.exe
./flashfetch.exe
name: fastfetch-win7
path: ./fastfetch-*-Win7.zip
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'LinusDierheimer/fastfetch'
@@ -280,6 +280,7 @@ jobs:
- macos
- freebsd
- windows
- win7
permissions:
contents: write
steps:
@@ -299,4 +300,4 @@ jobs:
tag: ${{ needs.linux.outputs.ffversion }}
commit: ${{ github.sha }}
artifactErrorsFailBuild: true
artifacts: fastfetch-linux/*,fastfetch-macos/*,fastfetch-freebsd/*,fastfetch-windows/*
artifacts: fastfetch-linux/*,fastfetch-macos/*,fastfetch-freebsd/*,fastfetch-windows/*,fastfetch-win7/*
+26 -5
View File
@@ -1,3 +1,24 @@
# 1.8.2
Bugfixes:
* Fix memleaks Users module (Windows)
* Fix shell detection when installed with scoop (Windows)
* Don't use libcJSON as wlanapi's dll name (Windows)
* Align artifact names to other platforms (Windows)
# 1.8.1
Notable Changes:
* `Song` was used as an alias to `Media` module. It's removed to avoid confusion. All song related flags (`--song-key`, etc) should change to media (`--media-key`, etc). (@CarterLi)
Bugfixes:
* Mountpoint paths on linux get decoded correctly (#364)
* Color parsing once again works (@IanManske, #365)
* Using a custom key with a placeholder for the local ip module now does work correctly if multiple interfaces are present (#368)
# 1.8.0
This release introduces Windows support! Fastfetch now fully support all major desktop OSes (Linux, macOS, Windows and FreeBSD)
@@ -49,7 +70,7 @@ Logos:
Bugfixes:
* Fixes disk size detection on 32bit Linux (#337)
* Fixes cpu freq detection in WSL
* Fixes cpu freq detection in WSL
* Fixes internal bug of FFstrbuf
* Fixes some memory leaks
* Fixes segfault if 0 is given as argument index
@@ -72,7 +93,7 @@ Features:
* MacPorts package manager support (@SladeGetz, #234)
* Battery support for MacOS (@CarterLi, #235)
* Processes, swap & terminal font support for MacOS(@CarterLi, #237)
* Song support for MacOS (@CarterLi, #242)
* Media support for MacOS (@CarterLi, #242)
* Player support for MacOS (@CarterLi, #245)
* WM theme support for MacOS (@CarterLi, #246)
* CPU usage support for MacOS (@CarterLi, #247)
@@ -125,12 +146,12 @@ Other:
# 1.7.0
This release brings support for MacOS!
This release brings support for MacOS!
The basics things are working, but it is far from feature parity with Linux.
I developed this in a VM, so bugs on real hardware are likely.
If you have a Mac and no idea what to do with your free time, i am very happy to accept pull requests / work on issues.
A lot of things were changed under the hood to make this possible, which should bring better performance and stability on all platforms.
A lot of things were changed under the hood to make this possible, which should bring better performance and stability on all platforms.
Besides that, the following things have changed:
@@ -196,7 +217,7 @@ Features:
* Load `/etc/fastfetch/config.conf` before user config
* Disk: print one decimal point if size < 100GB
* `--title-fqdn` option, to print fully qualified domain name instead of host name in title
Logos:
* updated old NixOS logo
+3 -2
View File
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
project(fastfetch
VERSION 1.8.0
VERSION 1.8.2
LANGUAGES C
DESCRIPTION "Fast system information tool"
HOMEPAGE_URL "https://github.com/LinusDierheimer/fastfetch"
@@ -284,7 +284,7 @@ set(LIBFASTFETCH_SRC
src/modules/resolution.c
src/modules/separator.c
src/modules/shell.c
src/modules/song.c
src/modules/media.c
src/modules/terminal.c
src/modules/terminalfont.c
src/modules/theme.c
@@ -654,6 +654,7 @@ if(APPLE)
PRIVATE "-weak_framework MediaRemote -F /System/Library/PrivateFrameworks"
)
elseif(WIN32)
target_compile_definitions(libfastfetch PRIVATE -D_WIN32_WINNT=0x0601)
target_link_libraries(libfastfetch
PRIVATE "dwmapi"
PRIVATE "gdi32"
+11 -10
View File
@@ -12,17 +12,18 @@ Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for
## Customization
With customization and speed being two competing goals, this project actually builds two executables.
The main one being `fastfetch`, which can be very greatly configured via flags. These flags can be made persistent in `~/.config/fastfetch/config.conf`. To view the available options run `fastfetch --help`.
The second executable being built is called `flashfetch`, which is configured at compile time to eliminate any possible overhead. Configuration of it can be very easily done in [`src/flashfetch.c`](src/flashfetch.c).
At the moment the performance difference is measurable, but too small to be human recognizable. But the leap will get bigger with more and more options coming, and on slow machines this might actually make a difference.
With customization and speed being two competing goals, this project actually builds two executables.
* The main one being `fastfetch`, which can be very greatly configured via flags. These flags can be made persistent in `~/.config/fastfetch/config.conf`. To view the available options run `fastfetch --help`.
* The second executable being built is called `flashfetch`, which is configured at compile time to eliminate any possible overhead. Configuration of it can be very easily done in [`src/flashfetch.c`](src/flashfetch.c).
At the moment the performance difference is measurable, but too small to be human recognizable. But the leap will get bigger with more and more options coming, and on slow machines this might actually make a difference.
There are some premade config files in [`presets`](presets), including the ones used for the screenshots above. You can load them using `--load-config <filename>`. They may also serve as a good example for format arguments.
## Dependencies
Fastfetch dynamically loads needed libraries if they are available. On Linux, its only hard dependencies are `libc` (any implementation of the c standard library), `libdl` and [`libpthread`](https://man7.org/linux/man-pages/man7/pthreads.7.html) (if built with multithreading support). They are all shipped with [`glibc`](https://www.gnu.org/software/libc/), which is already installed on most linux distributions.
Fastfetch dynamically loads needed libraries if they are available. On Linux, its only hard dependencies are `libc` (any implementation of the c standard library), `libdl` and [`libpthread`](https://man7.org/linux/man-pages/man7/pthreads.7.html) (if built with multithreading support). They are all shipped with [`glibc`](https://www.gnu.org/software/libc/), which is already installed on most linux distributions.
The following libraries are used if present at runtime:
@@ -66,9 +67,9 @@ For the image logo, iTerm with iterm image protocol should work. Apple Terminal
* [`libvulkan`](https://www.vulkan.org/): Vulkan module. Usually has been provided by GPU drivers. [`vulkan-loader`](https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-vulkan-loader) [`vulkan-headers`](https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-vulkan-headers)
* [`libOpenCL`](https://www.khronos.org/opencl/): OpenCL module. [`opencl-icd`](https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-opencl-icd)
Note: In Windows 7, 8 and 8.1, [ConEmu](https://conemu.github.io/en/AnsiEscapeCodes.html) is required to run fastfetch due to [the lack of ASCII escape code native support](https://en.wikipedia.org/wiki/ANSI_escape_code#DOS,_OS/2,_and_Windows). In addition, special build `fastfetch-windows-old` in [Github Actions](https://github.com/LinusDierheimer/fastfetch/actions) is provided to support these old systems, which
Note: In Windows 7, 8 and 8.1, [ConEmu](https://conemu.github.io/en/AnsiEscapeCodes.html) is required to run fastfetch due to [the lack of ASCII escape code native support](https://en.wikipedia.org/wiki/ANSI_escape_code#DOS,_OS/2,_and_Windows). In addition, special build `fastfetch-win7` is provided to support these old systems, which
1. Build with the ancient MSVCRT C runtime library, instead of the modern [UCRT](https://learn.microsoft.com/en-us/cpp/windows/universal-crt-deployment) C runtime library
1. Build with the ancient [MSVCRT](https://en.wikipedia.org/wiki/Microsoft_Windows_library_files#MSVCRT.DLL,_MSVCP*.DLL_and_CRTDLL.DLL) C runtime library, instead of the modern [UCRT](https://learn.microsoft.com/en-us/cpp/windows/universal-crt-deployment) C runtime library
2. Disable stdout application buffer, which seems to problematic for ConEmu.
For the image logo, only chafa is supported due to [the design flaw of ConPTY](https://github.com/microsoft/terminal/issues/1173). In addition, chafa support is not built by default due to the massive dependencies of imagemagick. You must built it yourself.
@@ -118,7 +119,7 @@ Konsole, Gnome Terminal, Tilix, XFCE4 Terminal, Alacritty, Kitty, LXTerminal, De
## Building
fastfetch uses [`cmake`](https://cmake.org/) for building. [`pkg-config`](https://www.freedesktop.org/wiki/Software/pkg-config/) is recommended for better library detection. The simplest steps to build the fastfetch and flashfetch binaries are:
fastfetch uses [`cmake`](https://cmake.org/) for building. [`pkg-config`](https://www.freedesktop.org/wiki/Software/pkg-config/) is recommended for better library detection. The simplest steps to build the fastfetch and flashfetch binaries are:
```bash
mkdir -p build
cd build
@@ -134,7 +135,7 @@ Currently GCC or clang is required (MSVC is not supported). MSYS2 with CLANG64 s
1. Install [MSYS2](https://www.msys2.org/#installation)
1. Open `MSYS2 CLANG64` (not `MSYS2 / MSYS`, which targets cygwin C runtime)
1. Install dependencies
1. Install dependencies
```bash
pacman -Syu mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-pkgconf mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-cjson mingw-w64-clang-x86_64-vulkan-loader mingw-w64-clang-x86_64-opencl-icd
```
+1 -1
View File
@@ -1 +1 @@
--structure Title:Separator:OS:Host:Bios:Board:Chassis:Kernel:Uptime:Processes:Packages:Shell:Resolution:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:CPUUsage:GPU:Memory:Swap:Disk:Battery:PowerAdapter:Player:Song:PublicIP:LocalIP:Wifi:DateTime:Locale:Vulkan:OpenGL:OpenCL:Users:Weather:Break:Colors
--structure Title:Separator:OS:Host:Bios:Board:Chassis:Kernel:Uptime:Processes:Packages:Shell:Resolution:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:CPUUsage:GPU:Memory:Swap:Disk:Battery:PowerAdapter:Player:Media:PublicIP:LocalIP:Wifi:DateTime:Locale:Vulkan:OpenGL:OpenCL:Users:Weather:Break:Colors
+2 -2
View File
@@ -193,7 +193,7 @@ static void defaultConfig(FFinstance* instance)
initModuleArg(&instance->config.weather);
initModuleArg(&instance->config.wifi);
initModuleArg(&instance->config.player);
initModuleArg(&instance->config.song);
initModuleArg(&instance->config.media);
initModuleArg(&instance->config.dateTime);
initModuleArg(&instance->config.date);
initModuleArg(&instance->config.time);
@@ -425,7 +425,7 @@ static void destroyConfig(FFinstance* instance)
destroyModuleArg(&instance->config.weather);
destroyModuleArg(&instance->config.wifi);
destroyModuleArg(&instance->config.player);
destroyModuleArg(&instance->config.song);
destroyModuleArg(&instance->config.media);
destroyModuleArg(&instance->config.dateTime);
destroyModuleArg(&instance->config.date);
destroyModuleArg(&instance->config.time);
+3 -3
View File
@@ -247,7 +247,7 @@
#--wifi-key Wifi
#--weather-key Weather
#--player-key Media Player
#--song-key Song
#--media-key Media
#--datetime-key Date Time
#--vulkan-key Vulkan
#--opengl-key OpenGL
@@ -290,7 +290,7 @@
#--public-ip-format
#--weather-format
#--player-format
#--song-format
#--media-format
#--datetime-format
#--vulkan-format
#--opengl-format
@@ -333,7 +333,7 @@
#--public-ip-error
#--weather-error
#--player-error
#--song-error
#--media-error
#--datetime-error
#--vulkan-error
#--opengl-error
+1 -1
View File
@@ -18,6 +18,7 @@ Icons
Kernel
Locale
LocalIP
Media
Memory
OpenGL
OS
@@ -29,7 +30,6 @@ PublicIP
Resolution
Separator
Shell
Song
Swap
Terminal
TerminalFont
+27 -2
View File
@@ -1,8 +1,33 @@
#include "disk.h"
#include <limits.h>
#include <ctype.h>
#include <sys/statvfs.h>
static void strbufAppendMountPoint(FFstrbuf* mountpoint, const char* source)
{
while(*source != '\0' && !isspace(*source))
{
//After a backslash the next 3 characters are octal ascii codes
if(*source == '\\' && strnlen(source, 4) == 4)
{
char octal[4] = {0};
strncpy(octal, source + 1, 3);
long value = strtol(octal, NULL, 8); //Returns 0 on error, so no need to check endptr
if(value > 0 && value < CHAR_MAX)
{
ffStrbufAppendC(mountpoint, (char) value);
source += 4;
continue;
}
}
ffStrbufAppendC(mountpoint, *source);
++source;
}
}
void ffDetectDisksImpl(FFDiskResult* disks)
{
FILE* mountsFile = fopen("/proc/mounts", "r");
@@ -25,7 +50,7 @@ void ffDetectDisksImpl(FFDiskResult* disks)
if(strncmp(currentPos, "/dev/", 5) != 0 && strncmp(currentPos, "drvfs", 5) != 0)
continue;
//Skip /dev/
//Skip /dev/ or drvfs
currentPos += 5;
//Don't show loop file systems
@@ -41,7 +66,7 @@ void ffDetectDisksImpl(FFDiskResult* disks)
++currentPos;
ffStrbufInitA(&disk->mountpoint, 16);
ffStrbufAppendSUntilC(&disk->mountpoint, currentPos, ' ');
strbufAppendMountPoint(&disk->mountpoint, currentPos);
//Go to filesystem
currentPos += disk->mountpoint.length;
@@ -120,6 +120,8 @@ static uint32_t getShellInfo(FFTerminalShellResult* result, uint32_t pid)
ffStrbufIgnCaseEqualS(&result->shellPrettyName, "gdb") ||
ffStrbufIgnCaseEqualS(&result->shellPrettyName, "lldb") ||
ffStrbufIgnCaseEqualS(&result->shellPrettyName, "guake-wrapped") ||
ffStrbufIgnCaseEqualS(&result->shellPrettyName, "fastfetch") || //scoop warps the real binaries with a "shim" exe
ffStrbufIgnCaseEqualS(&result->shellPrettyName, "flashfetch") ||
ffStrbufContainIgnCaseS(&result->shellPrettyName, "debug")
) {
ffStrbufClear(&result->shellProcessName);
+2 -22
View File
@@ -2,27 +2,7 @@
#include "util/windows/unicode.h"
#include <wtsapi32.h>
//at the time of writing, <wtsapi32.h> of MinGW doesn't have the definition of WTSEnumerateSessionsExW
typedef struct _WTS_SESSION_INFO_1W {
DWORD ExecEnvId;
WTS_CONNECTSTATE_CLASS State;
DWORD SessionId;
LPWSTR pSessionName;
LPWSTR pHostName;
LPWSTR pUserName;
LPWSTR pDomainName;
LPWSTR pFarmName;
} WTS_SESSION_INFO_1W, * PWTS_SESSION_INFO_1W;
BOOL
WINAPI
WTSEnumerateSessionsExW(
HANDLE hServer,
DWORD* pLevel,
DWORD Filter,
PWTS_SESSION_INFO_1W* ppSessionInfo,
DWORD* pCount);
#include "wtsapi32_extend.h"
void ffDetectUsers(FFlist* users, FFstrbuf* error)
{
@@ -48,7 +28,7 @@ void ffDetectUsers(FFlist* users, FFstrbuf* error)
ffStrbufInitF((FFstrbuf*)ffListAdd(users), "%s\\%s", domainName.chars, userName.chars);
}
WTSFreeMemory(sessionInfo);
WTSFreeMemoryExW(WTSTypeSessionInfoLevel1, sessionInfo, 1);
if(users->length == 0)
ffStrbufAppendS(error, "Unable to detect users");
+45
View File
@@ -0,0 +1,45 @@
#pragma once
//at the time of writing, <wtsapi32.h> of MinGW doesn't have the definition of WTSEnumerateSessionsExW and friends
#if (_WIN32_WINNT >= 0x0601)
typedef struct _WTS_SESSION_INFO_1A {
DWORD ExecEnvId;
WTS_CONNECTSTATE_CLASS State;
DWORD SessionId;
LPSTR pSessionName;
LPSTR pHostName;
LPSTR pUserName;
LPSTR pDomainName;
LPSTR pFarmName;
} WTS_SESSION_INFO_1A, *PWTS_SESSION_INFO_1A;
typedef struct _WTS_SESSION_INFO_1W {
DWORD ExecEnvId;
WTS_CONNECTSTATE_CLASS State;
DWORD SessionId;
LPWSTR pSessionName;
LPWSTR pHostName;
LPWSTR pUserName;
LPWSTR pDomainName;
LPWSTR pFarmName;
} WTS_SESSION_INFO_1W, * PWTS_SESSION_INFO_1W;
#define WTS_SESSION_INFO_1 __MINGW_NAME_AW(WTS_SESSION_INFO_1)
#define PWTS_SESSION_INFO_1 __MINGW_NAME_AW(PWTS_SESSION_INFO_1)
WINBOOL WINAPI WTSEnumerateSessionsExA(HANDLE hServer,DWORD* pLevel,DWORD Filter,PWTS_SESSION_INFO_1A* ppSessionInfo,DWORD* pCount);
WINBOOL WINAPI WTSEnumerateSessionsExW(HANDLE hServer,DWORD* pLevel,DWORD Filter,PWTS_SESSION_INFO_1W* ppSessionInfo,DWORD* pCount);
#define WTSEnumerateSessionsEx __MINGW_NAME_AW(WTSEnumerateSessionsEx)
typedef enum _WTS_TYPE_CLASS {
WTSTypeProcessInfoLevel0,
WTSTypeProcessInfoLevel1,
WTSTypeSessionInfoLevel1
} WTS_TYPE_CLASS;
BOOL WTSFreeMemoryExA(WTS_TYPE_CLASS WTSTypeClass,PVOID pMemory,ULONG NumberOfEntries);
BOOL WTSFreeMemoryExW(WTS_TYPE_CLASS WTSTypeClass,PVOID pMemory,ULONG NumberOfEntries);
#define WTSFreeMemoryEx __MINGW_NAME_AW(WTSFreeMemoryEx)
#endif /*(_WIN32_WINNT >= 0x0601)*/
+1 -1
View File
@@ -60,7 +60,7 @@ const char* ffDetectWifi(const FFinstance* instance, FFlist* result)
case kCWPHYMode11ac:
ffStrbufAppendS(&item->conn.phyType, "802.11ac (Wi-Fi 5)");
break;
case kCWPHYMode11ax:
case 6 /*kCWPHYMode11ax*/:
ffStrbufAppendS(&item->conn.phyType, "802.11ax (Wi-Fi 6)");
break;
case 7 /*kCWPHYMode11be?*/:
+2 -2
View File
@@ -40,9 +40,9 @@ static void convertIfStateToString(WLAN_INTERFACE_STATE state, FFstrbuf* result)
}
}
const char* ffDetectWifi(const FFinstance* instance, FFlist* result)
const char* ffDetectWifi(FF_UNUSED_PARAM const FFinstance* instance, FFlist* result)
{
FF_LIBRARY_LOAD(wlanapi, &instance->config.libcJSON, "dlopen wlanapi"FF_LIBRARY_EXTENSION" failed", "wlanapi"FF_LIBRARY_EXTENSION, 1)
FF_LIBRARY_LOAD(wlanapi, NULL, "dlopen wlanapi"FF_LIBRARY_EXTENSION" failed", "wlanapi"FF_LIBRARY_EXTENSION, 1)
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(wlanapi, WlanOpenHandle)
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(wlanapi, WlanEnumInterfaces)
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(wlanapi, WlanQueryInterface)
+6 -5
View File
@@ -389,9 +389,9 @@ static inline void printCommandHelp(const char* command)
"URL name"
);
}
else if(strcasecmp(command, "song-format") == 0 || strcasecmp(command, "media-format") == 0)
else if(strcasecmp(command, "media-format") == 0)
{
constructAndPrintCommandHelpFormat("song", "{3} - {1}", 4,
constructAndPrintCommandHelpFormat("media", "{3} - {1}", 4,
"Pretty media name",
"Media name",
"Artist name",
@@ -701,6 +701,7 @@ static void optionParseColor(const char* key, const char* value, FFstrbuf* buffe
else FF_APPEND_COLOR_CODE_COND(magenta, "35")
else FF_APPEND_COLOR_CODE_COND(cyan, "36")
else FF_APPEND_COLOR_CODE_COND(white, "37")
else
{
ffStrbufAppendC(buffer, *value);
++value;
@@ -1121,7 +1122,7 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
else if(optionParseModuleArgs(key, value, "public-ip", &instance->config.publicIP)) {}
else if(optionParseModuleArgs(key, value, "weather", &instance->config.weather)) {}
else if(optionParseModuleArgs(key, value, "player", &instance->config.player)) {}
else if(optionParseModuleArgs(key, value, "song", &instance->config.song)) {}
else if(optionParseModuleArgs(key, value, "media", &instance->config.media)) {}
else if(optionParseModuleArgs(key, value, "datetime", &instance->config.dateTime)) {}
else if(optionParseModuleArgs(key, value, "date", &instance->config.date)) {}
else if(optionParseModuleArgs(key, value, "time", &instance->config.time)) {}
@@ -1379,8 +1380,8 @@ static void parseStructureCommand(FFinstance* instance, FFdata* data, const char
ffPrintWeather(instance);
else if(strcasecmp(line, "player") == 0)
ffPrintPlayer(instance);
else if(strcasecmp(line, "media") == 0 || strcasecmp(line, "song") == 0)
ffPrintSong(instance);
else if(strcasecmp(line, "media") == 0)
ffPrintMedia(instance);
else if(strcasecmp(line, "datetime") == 0)
ffPrintDateTime(instance);
else if(strcasecmp(line, "date") == 0)
+2 -2
View File
@@ -134,7 +134,7 @@ typedef struct FFconfig
FFModuleArgs publicIP;
FFModuleArgs weather;
FFModuleArgs player;
FFModuleArgs song;
FFModuleArgs media;
FFModuleArgs dateTime;
FFModuleArgs date;
FFModuleArgs time;
@@ -288,7 +288,7 @@ void ffPrintBattery(FFinstance* instance);
void ffPrintPowerAdapter(FFinstance* instance);
void ffPrintLocale(FFinstance* instance);
void ffPrintPlayer(FFinstance* instance);
void ffPrintSong(FFinstance* instance);
void ffPrintMedia(FFinstance* instance);
void ffPrintDateTime(FFinstance* instance);
void ffPrintDate(FFinstance* instance);
void ffPrintTime(FFinstance* instance);
+1 -1
View File
@@ -48,7 +48,7 @@ int main(int argc, char** argv)
ffPrintBattery(&instance);
ffPrintPowerAdapter(&instance);
//ffPrintPlayer(&instance);
//ffPrintSong(&instance);
//ffPrintMedia(&instance);
//ffPrintLocalIp(&instance);
//ffPrintPublicIp(&instance);
//ffPrintWifi(&instance);
+1
View File
@@ -40,6 +40,7 @@ void ffPrintLocalIp(FFinstance* instance)
}
else
{
ffStrbufClear(&key);
ffParseFormatString(&key, &instance->config.localIP.key, 1, (FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->name}
});
+7 -7
View File
@@ -4,8 +4,8 @@
#include <ctype.h>
#define FF_SONG_MODULE_NAME "Media"
#define FF_SONG_NUM_FORMAT_ARGS 5
#define FF_MEDIA_MODULE_NAME "Media"
#define FF_MEDIA_NUM_FORMAT_ARGS 5
static bool shouldIgoreChar(char c)
{
@@ -42,13 +42,13 @@ static bool artistInSongTitle(const FFstrbuf* song, const FFstrbuf* artist)
return false;
}
void ffPrintSong(FFinstance* instance)
void ffPrintMedia(FFinstance* instance)
{
const FFMediaResult* media = ffDetectMedia(instance);
if(media->error.length > 0)
{
ffPrintError(instance, FF_SONG_MODULE_NAME, 0, &instance->config.song, "%s", media->error.chars);
ffPrintError(instance, FF_MEDIA_MODULE_NAME, 0, &instance->config.media, "%s", media->error.chars);
return;
}
@@ -69,7 +69,7 @@ void ffPrintSong(FFinstance* instance)
if(songPretty.length == 0)
ffStrbufAppend(&songPretty, &media->song);
if(instance->config.song.outputFormat.length == 0)
if(instance->config.media.outputFormat.length == 0)
{
//We don't expose artistPretty to the format, as it might be empty (when the think that the artist is already in the song title)
FFstrbuf artistPretty;
@@ -81,7 +81,7 @@ void ffPrintSong(FFinstance* instance)
if(artistInSongTitle(&songPretty, &artistPretty))
ffStrbufClear(&artistPretty);
ffPrintLogoAndKey(instance, FF_SONG_MODULE_NAME, 0, &instance->config.song.key);
ffPrintLogoAndKey(instance, FF_MEDIA_MODULE_NAME, 0, &instance->config.media.key);
if(artistPretty.length > 0)
{
@@ -98,7 +98,7 @@ void ffPrintSong(FFinstance* instance)
}
else
{
ffPrintFormat(instance, FF_SONG_MODULE_NAME, 0, &instance->config.song, FF_SONG_NUM_FORMAT_ARGS, (FFformatarg[]){
ffPrintFormat(instance, FF_MEDIA_MODULE_NAME, 0, &instance->config.media, FF_MEDIA_NUM_FORMAT_ARGS, (FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &songPretty},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->song},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->artist},