Skip to content

Commit

Permalink
Merge pull request #28 from EvanBldy/main
Browse files Browse the repository at this point in the history
Various commits + v0.4.2
  • Loading branch information
EvanBldy authored Jan 27, 2022
2 parents 581fb56 + cbb60a1 commit 5bd2fbc
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 35 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ You need to download the connectors-{version}.zip archive in the [releases](http

#### Blender (version>2.80)

- You need to go inside the blender directory.
- You need to go inside the connectors/blender directory.

- On Windows (with PowerShell):

Expand Down Expand Up @@ -158,7 +158,7 @@ You need to download the connectors-{version}.zip archive in the [releases](http

#### Toon Boom Harmony

- You need to go inside the harmony directory.
- You need to go inside the connectors/harmony directory.

- On Windows (with PowerShell):

Expand Down
24 changes: 16 additions & 8 deletions app/main/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ import {
} from 'electron'
import { join } from 'path'
import { URL } from 'url'
import { spawn } from 'child_process'
import { spawn, exec } from 'child_process'
const colors = require('colors')
const iconv = require('iconv-lite')
const open = require('open')
const windowStateKeeper = require('electron-window-state')
var codePage
if (process.platform === 'win32') {
codePage = require('win-codepage')
}
const formatUnicorn = require('format-unicorn/safe')
import { store, config } from './store'

config.set('appVersion', app.getVersion())
Expand Down Expand Up @@ -155,25 +152,36 @@ const createWindow = async () => {

await mainWindow.loadURL(pageUrl)

var codePage = undefined
if (process.platform === 'win32') {
codePage = await codePage()
exec('chcp', (err, stdout, stderr) => {
if (stdout) {
try {
codePage = Number(stdout.split(':')[1])
} catch {
codePage = undefined
}
}
})
}

ipcMain.handle('dark-theme:toggle', () => {
nativeTheme.themeSource = store.get('main.isDarkTheme') ? 'dark' : 'light'
return store.get('main.isDarkTheme')
})

ipcMain.handle('launch-command:post-exports', (event, command) => {
ipcMain.handle('launch-command:post-exports', (event, command, variables) => {
if (command === '') {
console.log('No command to launch before importing to Kitsu Publisher.')
return false
} else {
command = formatUnicorn(command, variables)
const commandOutput = { output: '', command: command }
const commandSpawn = spawn(command, [], {
shell: true,
encoding: 'buffer',
windowsHide: true,
env: { ...process.env, ...variables },
timeout: 60000 // TODO : make the timeout configurable
})
console.log(
Expand All @@ -182,7 +190,7 @@ const createWindow = async () => {

const manageOutputData = (data, isStdout) => {
var output
if (process.platform === 'win32') {
if (process.platform === 'win32' && codePage !== undefined) {
// get Windows code page
output = iconv.decode(data, `cp${codePage}`)
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/preload/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const api = {
openDialog: (options) => {
return ipcRenderer.invoke('open-dialog:show', options)
},
launchCommandBeforeExport: (command) => {
return ipcRenderer.invoke('launch-command:post-exports', command)
launchCommandBeforeExport: (command, variables) => {
return ipcRenderer.invoke('launch-command:post-exports', command, variables)
},
toggleDarkTheme: () => {
return ipcRenderer.invoke('dark-theme:toggle')
Expand Down
30 changes: 14 additions & 16 deletions app/renderer/src/components/modals/AddPreviewModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ import files from '@/lib/files'
import FileUpload from '@/components/widgets/FileUpload.vue'
import Icon from '@/components/widgets/Icon'
import DCCClient from '@/lib/dccutils'
import formatUnicorn from 'format-unicorn/safe'
import AnsiUp from 'ansi_up'
export default {
Expand Down Expand Up @@ -375,22 +374,21 @@ export default {
this.DCCsExportsDirectory
)
).then((data) => {
const command = formatUnicorn(this.PostExportsCommand, {
exportsDirectory: this.DCCsExportsDirectory,
exportFile: data.file,
exportIsAnimation: isAnimation,
exportIsScreenshot: !isAnimation,
DCCName: DCCClient.DCCName,
DCCVersion: DCCClient.DCCVersion,
currentProject: DCCClient.currentProject,
cameraSelected: DCCClient.cameraSelected,
rendererSelected: DCCClient.rendererSelected,
extensionSelected: isAnimation
? DCCClient.videoExtensionSelected
: DCCClient.imageExtensionSelected
})
window.electron
.launchCommandBeforeExport(command)
.launchCommandBeforeExport(this.PostExportsCommand, {
exportsDirectory: this.DCCsExportsDirectory,
exportFile: data.file,
exportIsAnimation: isAnimation,
exportIsScreenshot: !isAnimation,
DCCName: DCCClient.DCCName,
DCCVersion: DCCClient.DCCVersion,
currentProject: DCCClient.currentProject,
cameraSelected: DCCClient.cameraSelected,
rendererSelected: DCCClient.rendererSelected,
extensionSelected: isAnimation
? DCCClient.videoExtensionSelected
: DCCClient.imageExtensionSelected
})
.then((success, _) => {
if (!success) {
this.exportCommandOutput = null
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/src/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ export default {
'Choose a directory for exports made by the DCCs',
post_exports_command: {
description: 'Command to launch after the exports made by the DCCs',
info: 'You can insert variables in your command. You just have to put the choosen variable under curly brackets (for example : {exportFile}). They are listed below:',
info: 'You can insert variables in your command. You just have to put the choosen variable under curly brackets (for example : {exportFile}). These variables are also in the environment variables at runtime. They are listed below:',
exportsDirectory:
'exportsDirectory (String) : the directory path where the exports are made.',
exportFile:
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@
"choose_dccs_exports_directory": "Choisissez un dossier pour les exports faits par les DCCs",
"post_exports_command": {
"description": "Commande à lancer après les exports des DCCs",
"info": "Vous pouvez insérer des variables dans votre commande. Vous avez juste à les mettre entre des accolades (par exemple: {exportFile}). Elles sont listées ci-dessous :",
"info": "Vous pouvez insérer des variables dans votre commande. Vous avez juste à les mettre entre des accolades (par exemple: {exportFile}). Ces variables sont aussi dans les variables d'environnement lors de l'exécution. Elles sont listées ci-dessous :",
"exportsDirectory": "exportsDirectory (String) : le chemin vers le dossier où les exports sont stockés.",
"exportFile": "exportFile (String): le chemin vers le fichier qui sera exporté.",
"exportIsAnimation": "exportIsAnimation (Boolean) : true si l'export est une animation sinon false.",
Expand Down
2 changes: 1 addition & 1 deletion connectors/blender/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ packages = find:
install_requires =
fastapi
uvicorn
dccutils @ git+https://github.com/cgwire/dccutils.git
dccutils==0.1.5

[options.packages.find]
include = dccutils_server*
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kitsu-publisher",
"version": "0.4.1",
"version": "0.4.2",
"description": "Desktop publisher for Kitsu",
"author": "CGWire <[email protected]>",
"repository": "https://github.com/cgwire/kitsu-publisher-next",
Expand Down Expand Up @@ -53,8 +53,7 @@
"vue3-popper": "1.4.1",
"vuex": "4.0.2",
"vuex-router-sync": "6.0.0-rc.1",
"wavesurfer.js": "5.2.0",
"win-codepage": "1.0.0"
"wavesurfer.js": "5.2.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/zip_connectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ archive.on('error', function (err) {

archive.pipe(output)

archive.directory('./connectors', false)
archive.directory('./connectors', 'connectors')

archive.finalize()

0 comments on commit 5bd2fbc

Please sign in to comment.