ການແບ່ງປັນສະຄຣິບ

ຜ່ານມາ, ລະຫັດ lua ທັງໝົດຂອງພວກເຮົາແມ່ນຢູ່ໃນ luarc. ນັ້ນແມ່ນວິທີທີ່ດີໃນການພັດທະນາສະຄຣິບ ແຕ່ບໍ່ຄ່ອຍສະດວກໃນການແຈກຢາຍ. ພວກເຮົາຕ້ອງເຮັດໃຫ້ມັນເປັນໂມດູນ lua ທີ່ຖືກຕ້ອງ. ເພື່ອເຮັດສິ່ງນັ້ນ, ພວກເຮົາຈະບັນທຶກລະຫັດໄວ້ໃນໄຟລ໌ແຍກຕ່າງຫາກ (ໃນທີ່ນີ້ແມ່ນ scp-storage.lua):

--[[
SCP STORAGE
a simple storage to export images via scp

AUTHOR
Jérémy Rosen (jeremy.rosen@enst-bretagne.fr)

INSTALLATION
* copy this file in $CONFIGDIR/lua/
* add the following line in the file $CONFIGDIR/luarc
  require "scp-storage"

USAGE
* select "Export via SCP" in the storage selection menu
* set the target directory 
* export your images

LICENSE
GPLv2

]]

darktable = require "darktable"
dtutils = require "lib/dtutils"

dtutils.check_min_api_version("7.0.0", ...)

local scp_path = darktable.new_widget("entry"){
  tooltip = "Complete path to copy to. Can include user and hostname",
  text = "",
  reset_callback = function(self) self.text = "" end
}

darktable.register_storage("scp_export","Export via scp",
  function( storage, image, format, filename,
     number, total, high_quality, extra_data)
    if not darktable.control.execute("scp "..filename.." "..
      scp_path.text
    ) then
      darktable.print_error("scp failed for "..tostring(image))
    end
  end,
  nil, --finalize
  nil, --supported
  nil, --initialize
  darktable.new_widget("box") {
    orientation = "horizontal",
    darktable.new_widget("label"){ label = "target SCP PATH " },
    scp_path,
})

darktable ຈະຊອກຫາສະຄຣິບ (ຕາມກົດເກົານປົກກະຕິຂອງ lua) ໃນໂຟນເດີມາດຕະຖານ ບວກກັບ $CONFIGDIR/lua/*.lua. ດັ່ງນັ້ນ ສະຄຣິບຂອງພວກເຮົາສາມາດເອີ້ນໃຊ້ໄດ້ງ່າຍໆໂດຍການເພີ່ມ require "scp-storage" ໃນໄຟລ໌ luarc. ໝາຍເຫດເພີ່ມເຕີມບາງຢ່າງ…

  • $CONFIGDIR ແທນ ໂຟນເດີກຳນົດຄ່າ ຂອງ darktable.

  • ຟັງຊັນ dtutils.check_min_api_version ຈະກວດສອບຄວາມເຂົ້າກັນໄດ້ໃຫ້ທ່ານ. "7.0.0" ແມ່ນເວີຊັນ API ທີ່ທ່ານໄດ້ທົດສອບສະຄຣິບຂອງທ່ານ ແລະ “...” ຈະກາຍເປັນຊື່ສະຄຣິບຂອງທ່ານ.

  • ໃຫ້ແນ່ໃຈວ່າໄດ້ປະກາດຟັງຊັນທັງໝົດຂອງທ່ານເປັນ local ເພື່ອບໍ່ໃຫ້ໄປລົບກວນ namespace ທົ່ວໄປ.

  • ໃຫ້ແນ່ໃຈວ່າທ່ານບໍ່ໄດ້ປະ debug prints ໄວ້ໃນລະຫັດຂອງທ່ານ – ໂດຍສະເພາະ darktable.print_error ທີ່ຊ່ວຍໃຫ້ທ່ານປະ debug prints ໄວ້ໃນລະຫັດສຸດທ້າຍໄດ້ໂດຍບໍ່ໄປລົບກວນຄອນໂຊນ.

  • ທ່ານສາມາດເລືອກໃບອະນຸຍາດ (license) ໃດກໍໄດ້ສຳລັບສະຄຣິບຂອງທ່ານ ແຕ່ສະຄຣິບທີ່ອັບໂຫຼດຂຶ້ນເວັບໄຊທ໌ຂອງ darktable ຕ້ອງເປັນ GPLv2.

ເມື່ອທ່ານຕື່ມຂໍ້ມູນຄົບທຸກຟີວ ແລະ ກວດສອບລະຫັດແລ້ວ, ທ່ານສາມາດອັບໂຫຼດມັນໄປທີ່ໜ້າສະຄຣິບຂອງພວກເຮົາໄດ້ ທີ່ນີ້.

translations